forked from xormplus/xorm
-
Notifications
You must be signed in to change notification settings - Fork 1
/
sqltemplate.go
56 lines (50 loc) · 1.63 KB
/
sqltemplate.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package xorm
import (
"html/template"
"os"
"github.com/CloudyKit/jet"
"gopkg.in/flosch/pongo2.v3"
)
type SqlTemplate interface {
WalkFunc(path string, info os.FileInfo, err error) error
paresSqlTemplate(filename string, filepath string) error
ReadTemplate(filepath string) ([]byte, error)
Execute(key string, args ...interface{}) (string, error)
RootDir() string
Extension() string
SetSqlTemplateCipher(cipher Cipher)
LoadSqlTemplate(filepath string) error
BatchLoadSqlTemplate(filepathSlice []string) error
ReloadSqlTemplate(filepath string) error
BatchReloadSqlTemplate(filepathSlice []string) error
AddSqlTemplate(key string, sqlTemplateStr string) error
UpdateSqlTemplate(key string, sqlTemplateStr string) error
RemoveSqlTemplate(key string)
BatchAddSqlTemplate(key string, sqlTemplateStrMap map[string]string) error
BatchUpdateSqlTemplate(key string, sqlTemplateStrMap map[string]string) error
BatchRemoveSqlTemplate(key []string)
}
func Pongo2(directory, extension string) *Pongo2Template {
template := make(map[string]*pongo2.Template, 100)
return &Pongo2Template{
SqlTemplateRootDir: directory,
extension: extension,
Template: template,
}
}
func Default(directory, extension string) *HTMLTemplate {
template := make(map[string]*template.Template, 100)
return &HTMLTemplate{
SqlTemplateRootDir: directory,
extension: extension,
Template: template,
}
}
func Jet(directory, extension string) *JetTemplate {
template := make(map[string]*jet.Template, 100)
return &JetTemplate{
SqlTemplateRootDir: directory,
extension: extension,
Template: template,
}
}