entc/gen: add option to add dialect specific config

This commit is contained in:
Ariel Mashraki
2021-01-05 10:22:42 +02:00
committed by Ariel Mashraki
parent 5ea9e61b51
commit 0f9fa5b633
2 changed files with 13 additions and 2 deletions

View File

@@ -310,7 +310,7 @@ func templateClientTmpl() (*asset, error) {
return a, nil
}
var _templateConfigTmpl = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x8c\x53\x4d\x6f\xe3\x36\x14\x3c\x8b\xbf\x62\x60\xf8\x60\x1b\x59\x7a\xbb\xb7\x16\xf0\x61\x91\xdd\xa2\x01\x82\xb4\x40\x7b\x2b\x8a\x82\x26\x9f\x64\xd6\x32\x9f\x4a\x52\x41\x03\xc1\xff\xbd\xe0\x87\x62\x05\xc8\x21\x27\x89\x7c\xf3\xbe\x66\x86\xd3\xb4\xdf\x89\x7b\x1e\x5e\xbc\xed\x4e\x11\x5f\x3e\xff\xf0\xe3\xa7\xc1\x53\x20\x17\xf1\xb3\xd2\x74\x64\x3e\xe3\xc1\x69\x89\xaf\x7d\x8f\x0c\x0a\x48\x71\xff\x4c\x46\x8a\x3f\x4e\x36\x20\xf0\xe8\x35\x41\xb3\x21\xd8\x80\xde\x6a\x72\x81\x0c\x46\x67\xc8\x23\x9e\x08\x5f\x07\xa5\x4f\x84\x2f\xf2\xf3\x1c\x45\xcb\xa3\x33\xc2\xba\x1c\x7f\x7c\xb8\xff\xfe\xf4\xfb\x77\xb4\xb6\x27\xd4\x3b\xcf\x1c\x61\xac\x27\x1d\xd9\xbf\x80\x5b\xc4\x45\xb3\xe8\x89\xa4\xd8\xed\xaf\x57\x21\xa6\x09\x86\x5a\xeb\x08\x2b\xcd\xae\xb5\xdd\x0a\xf5\x7a\x3d\x9c\x3b\xfc\x74\xc0\x51\x05\xc2\x5a\xde\xe7\xa8\xfc\x4d\xe9\xb3\xea\x28\x81\xa6\x09\x91\x2e\x43\xaf\x22\x61\x75\x22\x65\xc8\xaf\xb0\x9e\xd3\x6f\x21\x7b\x19\xd8\xc7\x39\xb4\xdf\xe3\xd7\x21\x5a\x76\x68\x47\xa7\xf3\x4f\x64\x94\xde\xa3\xa7\x3c\xbe\xee\x2d\xb9\x28\x45\x7c\x19\x68\x89\xde\xec\x0a\x6e\x9b\xcb\x94\x89\x12\x6b\x39\xa7\x56\x50\x05\xcd\x7e\x51\x09\xca\x19\xd8\x18\x70\x1c\x6d\x6f\xc8\xd7\xca\x25\x05\x21\xfa\x51\x47\x4c\xa2\xd9\xef\x61\xbc\x7d\x26\x8f\x31\x69\x90\x8a\xd0\x7f\xa4\xc7\x68\x5d\x07\xa3\xa2\xca\x5c\x78\xfa\x77\xa4\x10\x83\x14\x4d\x45\x1b\xab\x7a\xd2\x51\x7e\xcb\xc7\x52\x87\x8e\x63\x07\x72\xea\xd8\x13\x54\x3d\xf6\xdc\x75\xd6\x75\x29\x31\x9f\x8f\xcc\x7d\x46\xf7\xdc\xdd\x5a\x56\x14\xd8\xd5\xb4\x0b\x1b\x92\xa2\x49\xa0\xcc\x82\x94\xd2\xba\x48\xbe\x55\x9a\xa6\xeb\x36\x57\x38\x31\x9f\x43\x62\xb2\x0c\x4c\x29\xfb\x32\xc6\xcc\x46\x9a\xb4\xc4\x77\xf9\x23\x8a\x0c\xe5\x6a\x20\x5f\x59\xba\xcb\xdd\x5b\x15\x22\x94\xd6\x14\x42\xa5\xa9\xe0\x6e\x2c\x4d\xd3\x27\x78\xe5\x3a\xc2\xda\x25\x83\xac\xe5\x13\x1b\x0a\x49\x5d\x00\x68\x92\x77\x9c\x7c\x52\x97\xe4\x12\xfc\xf9\x57\x92\xf2\x17\xe6\x73\xc9\x24\x67\x12\x72\xe9\x84\x00\x35\x0c\xbd\xa5\x22\x24\xd7\x3b\x76\x0b\x5d\xc1\xc7\x7f\x12\xc3\x22\x11\x80\x8d\xc6\xec\x84\x19\xbe\xe1\x21\x06\x48\x29\x4b\xc9\x6d\x1a\x34\xad\xf3\xf7\x5d\x42\xa4\x31\xcb\xc8\x19\x36\x89\xa6\xe1\x21\x6e\xf4\x56\x34\x57\xd1\xd8\x16\x5a\x16\xaa\x53\x44\xcb\x2a\xeb\xe1\x26\x6c\x0a\x6e\xe6\xc0\x1d\xb4\xec\xb9\xcb\xc9\x65\x8f\x6f\x0b\xb5\xc3\x5b\xb1\xe7\x3d\x12\x0b\xc5\x1f\x75\x89\x52\x73\x3b\xfb\x7b\x12\x8d\xa7\x38\xfa\xea\xf4\xc5\x86\x75\xa6\x5c\xf4\x80\xe8\x47\xba\x35\x7e\xe4\x0e\x81\x62\x61\x6e\xee\xf8\xfa\xb0\x12\x01\x4b\x0b\xe5\xbe\x8f\xdc\x6d\x5a\xf7\xae\x93\x3e\x3c\x4c\xb2\xe2\x01\xad\x5b\x30\x50\x28\x7b\x7d\xc7\x61\xf9\xfc\xcc\x9b\xbd\xf3\x61\xf3\xee\xd3\xf9\x38\x1b\xaf\x0a\xd5\x27\x97\xe7\x98\xa6\xd9\x5e\xff\x07\x00\x00\xff\xff\xf2\xe9\x13\xff\x9b\x05\x00\x00")
var _templateConfigTmpl = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x9c\x54\xdf\x8b\x1b\x37\x10\x7e\xde\xfd\x2b\x06\xe3\x82\x6d\x2e\xda\x34\x6f\x2d\xdc\x43\xb8\xa4\x34\x70\x5c\x0b\xc9\x5b\x29\x45\x96\x66\x77\x55\xcb\x9a\xad\x34\x9b\xe6\x10\xf7\xbf\x17\xfd\x58\x7b\x03\x6e\x09\x7d\xb2\xe4\xf9\xe6\xd3\x37\x33\xdf\x6c\x8c\xdd\xa1\x7d\xa0\xe9\xd9\x9b\x61\x64\x78\xf3\xfa\xfb\x1f\x5e\x4d\x1e\x03\x3a\x86\x9f\xa4\xc2\x23\xd1\x09\x3e\x38\x25\xe0\xad\xb5\x90\x41\x01\x52\xdc\x7f\x46\x2d\xda\x4f\xa3\x09\x10\x68\xf6\x0a\x41\x91\x46\x30\x01\xac\x51\xe8\x02\x6a\x98\x9d\x46\x0f\x3c\x22\xbc\x9d\xa4\x1a\x11\xde\x88\xd7\x4b\x14\x7a\x9a\x9d\x6e\x8d\xcb\xf1\xc7\x0f\x0f\xef\x9f\x3e\xbe\x87\xde\x58\x84\xfa\x9f\x27\x62\xd0\xc6\xa3\x62\xf2\xcf\x40\x3d\xf0\xea\x31\xf6\x88\xa2\x3d\x74\x2f\x2f\x6d\x1b\x23\x68\xec\x8d\x43\xd8\x28\x72\xbd\x19\x36\x50\xff\xde\x4e\xa7\x01\x7e\xbc\x87\xa3\x0c\x08\x5b\xf1\x90\xa3\xe2\x57\xa9\x4e\x72\xc0\x04\x8a\x11\x18\xcf\x93\x95\x8c\xb0\x19\x51\x6a\xf4\x1b\xd8\x2e\xe9\xd7\x90\x39\x4f\xe4\x79\x09\x75\x1d\xfc\x32\xb1\x21\x07\xfd\xec\x54\x3e\x30\x41\x79\x7b\xf6\x98\xe5\x2b\x6b\xd0\xb1\x68\xf9\x79\xc2\x35\x7a\x77\x28\xb8\x7d\xa6\x29\x8a\x52\xd7\x72\x4e\x65\x90\x05\x4d\x7e\xc5\x04\xd2\x69\x30\x1c\xe0\x38\x1b\xab\xd1\x57\xe6\x92\x02\x81\xfd\xac\x18\x62\xdb\x74\x1d\x68\x6f\x3e\xa3\x87\x39\xcd\x20\x91\xe0\x17\x54\x33\x1b\x37\x80\x96\x2c\x73\x2f\x3c\xfe\x35\x63\xe0\x20\xda\xa6\xa2\xb5\x91\x16\x15\x8b\x77\xf9\x5a\x78\xf0\x38\x0f\x80\x4e\x1e\x2d\x82\xac\x57\x4b\xc3\x60\xdc\x90\x12\xf3\xfd\x48\x64\x33\xda\xd2\x70\x7d\xb2\xa2\x80\x5c\x4d\x3b\x93\x46\xd1\x36\x09\x94\xbb\x20\x84\x30\x8e\xd1\xf7\x52\x61\x7c\xd9\x67\x86\x91\xe8\x14\x52\x27\x8b\x60\x4c\xd9\xe7\x99\x73\x37\x92\xd2\x12\x3f\xe4\x9f\xb6\x89\xf1\x15\xfc\x6d\x78\x84\x2d\x9f\x27\x1b\xd2\x98\xcf\x92\xd5\xf8\x69\x19\xda\x6e\xf2\xc6\x71\x0f\x9b\x5a\x5a\xf7\x5d\xe8\x4a\xbb\xba\xde\xa0\xd5\xa1\x3b\x6c\x60\x2b\x3e\x32\x79\x39\xe0\x3e\x4d\xb6\x69\x62\x04\x2f\xdd\x80\x85\x35\x91\x56\xfa\x1c\x4d\xe1\x2f\x17\x57\x14\xc8\xf6\x92\x88\x4e\xe7\x73\x52\x56\xcf\xc5\x2c\x45\xf8\x84\xbe\xce\xf2\x2e\xf7\xa8\x97\x81\x41\x2a\x85\x21\xd4\x61\x16\xdc\x75\x96\x89\xa8\xaa\x71\x59\x8a\x78\x22\x8d\x59\x0b\x00\x40\x7a\x73\xeb\xc4\x93\x3c\x27\x2f\xc3\x6f\xbf\x27\xc3\xfd\x4c\x74\xba\x21\xa1\x38\x30\x80\x9c\x26\x6b\xb0\xd8\x8d\xea\x7f\xe4\x56\xee\x03\x3a\xfe\x99\x7c\xd0\xa6\x31\xc1\x4e\xc1\xe2\xd7\x05\xbe\xa3\x89\x03\x08\x21\x0a\xe5\x3e\x09\x4d\xe5\xfc\x71\x97\x10\x49\x66\x91\x9c\x61\xb1\x6d\x1a\x9a\x78\xa7\xf6\x6d\xf3\xd2\x36\xa6\x07\x25\x8a\x21\x52\x44\x89\x6a\xbe\xfb\xab\xfd\x52\x70\xb7\x04\xee\x40\x09\x4b\x43\x4e\x2e\x75\xbc\x5b\x79\x32\x7c\x6d\xc9\xa5\x8e\xd4\x85\xe2\xe2\x5a\x44\xe1\xdc\x2f\x5b\x18\xdb\xc6\x23\xcf\xbe\xee\xe3\xaa\xc2\xaa\x29\x93\xde\x03\xfb\x19\xaf\x0f\x3f\xd2\x00\x01\xb9\x74\x6e\x79\xf1\xb2\xfe\xa9\x01\x6b\xa3\xe7\x77\x1f\x69\xd8\xf5\xee\xa6\xdf\xbf\x59\x4c\x5a\x98\x7b\xe8\xdd\xaa\x03\xa5\x65\x97\xaf\x4d\x58\x7f\x24\xf4\x57\x75\xe7\xcb\xee\xe6\x82\x7f\x7b\x37\x2e\x13\xaa\x1f\x86\xac\x23\xc6\xff\xbd\x7b\xd5\x46\x37\x96\xef\xbf\x77\xef\x5f\x57\xef\xba\x79\xd7\xd3\xea\xf8\x4f\x00\x00\x00\xff\xff\x66\xa5\x41\xce\xe2\x06\x00\x00")
func templateConfigTmplBytes() ([]byte, error) {
return bindataRead(
@@ -325,7 +325,7 @@ func templateConfigTmpl() (*asset, error) {
return nil, err
}
info := bindataFileInfo{name: "template/config.tmpl", size: 1435, mode: os.FileMode(420), modTime: time.Unix(1, 0)}
info := bindataFileInfo{name: "template/config.tmpl", size: 1762, mode: os.FileMode(420), modTime: time.Unix(1, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}

View File

@@ -24,6 +24,11 @@ type config struct {
log func(...interface{})
// hooks to execute on mutations.
hooks *hooks
{{- with $tmpls := matchTemplate (printf "dialect/%s/config/fields/*" $.Storage) }}
{{ range $tmpl := $tmpls }}
{{ xtemplate $tmpl $ }}
{{ end }}
{{- end }}
}
// hooks per client, for fast access.
@@ -64,4 +69,10 @@ func Driver(driver dialect.Driver) Option {
}
}
{{ with $tmpls := matchTemplate (printf "dialect/%s/config/options/*" $.Storage) }}
{{ range $tmpl := $tmpls }}
{{ xtemplate $tmpl $ }}
{{ end }}
{{ end }}
{{ end }}