mirror of
				https://github.com/optim-enterprises-bv/vault.git
				synced 2025-10-31 02:28:09 +00:00 
			
		
		
		
	 6141d61839
			
		
	
	6141d61839
	
	
	
		
			
			strings.ReplaceAll(s, old, new) is a wrapper function for strings.Replace(s, old, new, -1). But strings.ReplaceAll is more readable and removes the hardcoded -1. Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
		
			
				
	
	
		
			16 lines
		
	
	
		
			246 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			16 lines
		
	
	
		
			246 B
		
	
	
	
		
			Go
		
	
	
	
	
	
| package postgresql
 | |
| 
 | |
| import (
 | |
| 	"fmt"
 | |
| 	"strings"
 | |
| )
 | |
| 
 | |
| // Query templates a query for us.
 | |
| func Query(tpl string, data map[string]string) string {
 | |
| 	for k, v := range data {
 | |
| 		tpl = strings.ReplaceAll(tpl, fmt.Sprintf("{{%s}}", k), v)
 | |
| 	}
 | |
| 
 | |
| 	return tpl
 | |
| }
 |