github.com/woocoos/entcache@v0.0.0-20231206055445-856f0148efa5/gen/entc.go (about) 1 package gen 2 3 import ( 4 "embed" 5 "entgo.io/ent/entc" 6 "entgo.io/ent/entc/gen" 7 ) 8 9 var ( 10 //go:embed template/* 11 _templates embed.FS 12 ) 13 14 // QueryCache returns an entc.Option that generates the cached Get. It overrides the default client.tmpl 15 func QueryCache() entc.Option { 16 return func(c *gen.Config) error { 17 c.Templates = append(c.Templates, gen.MustParse(gen.NewTemplate("client"). 18 ParseFS(_templates, "template/client.tmpl"))) 19 return nil 20 } 21 }