mirror of
https://github.com/ent/ent.git
synced 2026-05-24 09:31:56 +03:00
dialect/entsql: use annotation in schema builder (#929)
This commit is contained in:
@@ -32,6 +32,7 @@ var (
|
||||
"appends": reflect.AppendSlice,
|
||||
"order": order,
|
||||
"camel": camel,
|
||||
"dumpFields": dumpFields,
|
||||
"snake": snake,
|
||||
"pascal": pascal,
|
||||
"extend": extend,
|
||||
@@ -405,6 +406,24 @@ func toString(v interface{}) string {
|
||||
}
|
||||
}
|
||||
|
||||
// dumpFields dumps the struct fields into a Go format.
|
||||
func dumpFields(v interface{}) string {
|
||||
rv := indirect(reflect.ValueOf(v))
|
||||
rt := rv.Type()
|
||||
fields := make([]string, 0, rv.NumField())
|
||||
for i := 0; i < rv.NumField(); i++ {
|
||||
f := rt.Field(i)
|
||||
if f.PkgPath != "" {
|
||||
continue
|
||||
}
|
||||
fv := rv.Field(i)
|
||||
if !fv.IsZero() {
|
||||
fields = append(fields, fmt.Sprintf("%s: %#v", f.Name, fv.String()))
|
||||
}
|
||||
}
|
||||
return strings.Join(fields, ", ")
|
||||
}
|
||||
|
||||
// dict creates a dictionary from a list of pairs.
|
||||
func dict(v ...interface{}) map[string]interface{} {
|
||||
lenv := len(v)
|
||||
|
||||
@@ -1070,7 +1070,7 @@ func templateMigrateMigrateTmpl() (*asset, error) {
|
||||
return a, nil
|
||||
}
|
||||
|
||||
var _templateMigrateSchemaTmpl = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xac\x57\x4b\x6f\xdc\x36\x10\x3e\x4b\xbf\x62\x20\x6c\x8b\xc4\xd8\x95\x6c\xdf\x2a\x60\x0f\x86\xe3\x00\x46\x0a\x37\xa8\x9d\x93\x61\x14\x34\x35\x5a\x11\x2b\x91\x32\x45\xb9\xde\xaa\xfa\xef\x05\x1f\x7a\xed\xcb\x9b\x26\xbe\x58\x24\xe7\xc5\x6f\xe6\x9b\xe1\x36\x4d\x74\xe6\x5f\x8b\x72\x23\xd9\x2a\x53\x70\x79\x7e\xf1\xdb\xa2\x94\x58\x21\x57\xf0\x99\x50\x7c\x16\x62\x0d\xb7\x9c\x86\x70\x95\xe7\x60\x84\x2a\xd0\xe7\xf2\x15\x93\xd0\x7f\xc8\x58\x05\x95\xa8\x25\x45\xa0\x22\x41\x60\x15\xe4\x8c\x22\xaf\x30\x81\x9a\x27\x28\x41\x65\x08\x57\x25\xa1\x19\xc2\x65\x78\xde\x9d\x42\x2a\x6a\x9e\xf8\x8c\x9b\xf3\xdf\x6f\xaf\x6f\xee\xee\x6f\x20\x65\x39\x82\xdb\x93\x42\x28\x48\x98\x44\xaa\x84\xdc\x80\x48\x41\x8d\x9c\x29\x89\x18\xfa\x67\x51\xdb\xfa\x7e\xd3\x40\x82\x29\xe3\x08\x41\x45\x33\x2c\x48\x00\x76\x7b\x01\x7f\x33\x95\x01\xbe\x29\xe4\x09\xcc\x20\xf8\x4a\xe8\x9a\xac\x30\x80\xa0\x60\x2b\x49\x14\x06\xb0\x68\x5b\xdf\x6b\x1a\x50\x58\x94\x39\x51\x08\x41\x86\x24\x41\x19\x40\xa8\xad\x34\x0d\x68\x5d\x6d\x8f\x15\xa5\x90\x0a\x3e\x18\x71\x49\xf8\x0a\x61\xf6\xd7\x1c\x66\x1c\xe2\x25\xcc\xc2\x3b\x91\x60\xa5\x05\x3d\x2f\x68\x1a\x98\x85\xd7\x82\xa7\x6c\x15\x3a\x9f\xd0\xb6\x91\xde\xe6\xa3\x8d\x40\x9b\x5a\xf4\x0e\xbc\x60\xc5\x54\x56\x3f\x87\x54\x14\x51\xea\xc0\x8f\x90\xab\xc8\x5e\x2b\x4a\x19\xe6\x49\x70\x44\x2e\x61\x24\x47\xaa\xa2\xea\x25\x77\x3a\x81\xff\xd1\xf7\x5f\x89\xb4\x61\x2f\xc6\x71\x2b\x1b\xf7\x03\x79\xce\xbb\xc0\xb5\x44\x74\x06\x29\xe3\x09\xa8\x4d\x89\xc0\x4d\x4e\x6d\x42\x56\x92\x94\x59\x9f\x07\xa5\xd5\xe6\xc0\x52\xc0\x37\x56\xa9\x0a\x4c\x2e\xac\x89\x99\x51\x8b\x97\xc0\x78\x82\x6f\x3d\x36\xe7\x83\x93\xc3\xf0\x35\x8d\xb1\xf9\x02\x33\x15\xde\x91\x02\x35\x62\x26\x44\x7b\x66\x4d\x2f\xb5\x9a\x59\x5b\xec\x86\x2c\xb9\x00\xa8\xc8\xeb\x82\x57\xda\x74\x49\x2a\x4a\xf2\xde\xdc\xbf\x50\x4a\xc6\x55\x0a\xc1\x2f\xd5\xb5\x95\x0a\xac\x62\x14\x81\x76\xd0\xa9\xb6\x2d\x64\x22\x4f\x2a\x73\xf7\x6e\x33\x15\xb6\xa0\x4d\x86\x9d\xc5\xb6\x0d\x2c\x1a\xa1\xf1\x3e\xb1\xb0\x84\xc7\xa7\x33\x9b\x89\xd0\x7a\x6b\x7c\x6f\x02\x01\x35\xd7\x57\xee\xd4\xe5\xc1\xf3\x1a\xd0\xb6\x63\xeb\x88\xf6\x8e\xe6\xf0\xb0\x29\x31\x06\x53\x09\xa1\x3d\xd3\x3b\xba\xd8\x2a\xe5\xa4\xe6\xd6\x42\xb3\xd0\x48\xce\x68\xf8\x8d\xb3\x97\x5a\x1f\x80\xfd\x8a\x41\xc9\x1a\xe7\x63\xd0\xc6\xe2\xb7\x9c\x4a\x2c\x74\x03\x68\x5b\xe8\x17\xef\x28\xdd\xd5\x79\xee\xb2\x04\xdd\x77\x0c\x2e\xf8\xe1\x6c\x8f\xbe\xa1\xe8\x8c\x86\xf7\xec\x1f\xa3\xad\xff\x1b\xcd\xf0\xb8\xfc\x95\x52\x52\xcb\xeb\xff\x16\xa7\xd0\x20\x74\x58\xe3\x86\xd7\x85\xc9\x8a\xf9\x88\xe1\xf1\xa9\x52\x92\xf1\x55\x03\x03\xa1\x4d\xd9\x1a\x43\x3a\x76\x9c\x5a\x84\x63\xf1\x7c\xc2\x94\xd4\xb9\x01\xcd\x7d\x9e\x72\x8b\x7b\x53\x1b\x3a\x85\xe6\xee\xfd\x2a\x86\x82\x94\x8f\x36\xbe\x3d\x61\xae\xe7\x30\x7b\x9d\x84\xba\xd6\x1f\xae\x5e\x5e\xa7\x61\x0f\xf4\xb0\xa5\x31\xea\x39\x9e\xd7\x53\xc6\x94\xf0\x3b\x84\x31\x44\x9c\xd2\x45\x75\x59\x1f\xc8\x62\xeb\x1d\x18\x4f\x85\x2c\x88\x62\x82\x9f\xc6\x9b\xde\xd4\x12\x7e\x75\x9c\x31\x0e\x0d\x65\x46\x74\x18\xf4\xcd\x75\x1c\x73\xe2\x2d\xf6\x9a\xb3\xaf\x92\x15\x44\x6e\xbe\xe0\x26\xde\xcf\xc4\xed\x6e\x54\xae\x1d\x1f\x07\xcd\x2e\x6d\x63\x51\x36\x3f\xc8\xdc\x9e\x15\xba\x87\x95\x6b\xd7\xc4\x7a\x0a\x4f\x83\x7c\xd4\x4b\x06\x6d\xfb\xb4\x55\x23\xd3\x24\x6d\x2f\xed\xe5\x3e\x0b\x89\x6c\xc5\xbf\xe0\xa6\x1a\xdf\x6e\xd8\xde\x7b\xc3\xb4\xbb\xe1\x48\x7d\xf0\xea\xae\x70\xbf\x29\x9e\x45\xee\xf0\x4e\xd7\xa1\x5d\xf7\x90\x8f\x51\xdf\x0f\xab\x07\xb0\xe3\x99\x5e\x18\xcf\xe9\x7a\x17\xb2\x5d\x70\x2f\x0f\xa1\x3b\x05\x98\x5e\x74\x00\x5f\x7e\x2f\xc2\xbb\x20\xef\xdb\x69\xe7\x7d\x56\xa3\x33\x28\x45\xa5\x4a\xc1\x11\x24\xa6\x12\x39\x65\x7c\x05\x4a\x00\x79\x15\xcc\x4e\x4c\x9a\x21\x5d\xeb\xdd\x5c\x88\xb2\x1f\x8a\xfa\xef\x4f\x4c\x7f\x08\xb3\x41\xff\x7d\xd8\xac\xb8\x21\xcf\xff\x03\xb0\xeb\x01\x63\x43\xc7\xc6\xe7\x4f\x44\xb9\xeb\x8d\xe9\x3a\xfc\x83\x7f\x2b\x13\xa2\xa6\xd3\xad\xb3\xd1\x1d\xc6\xae\xdf\x84\x5d\xb3\xf5\x0f\xf8\xd8\x32\xfd\x09\x73\x3c\x68\xda\x1e\x9e\x6a\x7a\x34\x71\xb7\x39\xda\x4d\x48\x15\xde\xea\xb7\x10\xf6\x79\x70\xcb\x71\x2d\x98\xad\x66\xa7\xd7\xe8\x32\x60\xc9\x9b\xe3\xc3\x96\x99\x81\xb2\xe3\x0e\xc9\x92\xb7\x69\x8f\xd4\x7f\xdd\xf0\xef\x04\xfa\x67\x41\x2f\xf1\x5e\x7d\xee\xc6\xe5\xca\x53\x9b\x3b\x54\x67\xa7\x92\xfa\xe7\xb1\x7a\x4f\xc1\xed\xd9\xea\xaf\xdd\x7d\x6c\x89\xec\x9f\x95\xe3\x75\x14\x81\x7b\x3c\xdb\xd9\x47\xf2\xdc\x0c\x39\x65\x37\xdd\xb3\xd9\x01\xe9\x7b\x4e\x76\xfc\x24\xec\xc7\xdb\xfb\x4f\x73\x6f\xc4\xca\x63\x93\x79\xee\x4f\x83\x6e\xf5\x0f\x80\xb4\xe6\x14\x18\x67\xea\xc3\x47\x68\x4e\xfd\x21\xf0\xdd\x2f\x82\xad\x6c\x1f\x19\x34\xe3\x69\x3f\x3e\x1e\xd2\xda\xb7\x1d\x58\xc2\xa9\xfd\x68\x3b\x96\x0e\x82\xd1\xb7\xfd\xb5\xe8\x16\xff\x05\x00\x00\xff\xff\xa6\xf3\x85\xd8\xfc\x0e\x00\x00")
|
||||
var _templateMigrateSchemaTmpl = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xac\x57\x5b\x6f\xdb\x36\x14\x7e\x96\x7e\xc5\x81\xe0\x15\x6d\x60\x4b\x6d\xde\x26\xc0\x0f\x41\xda\x02\x41\x87\xac\x58\xda\xa7\x20\x18\x18\xea\xc8\x26\x2c\x91\x0a\x45\x65\xf1\x34\xfd\xf7\x81\x17\x49\x94\x6f\x71\xb7\xfa\xc5\xbc\x9c\xeb\x77\x6e\x54\xdb\x26\x17\xe1\xb5\xa8\xb6\x92\xad\xd6\x0a\x2e\xdf\x7f\xf8\x75\x51\x49\xac\x91\x2b\xf8\x4c\x28\x3e\x0a\xb1\x81\x1b\x4e\x63\xb8\x2a\x0a\x30\x44\x35\xe8\x7b\xf9\x8c\x59\x1c\x7e\x5b\xb3\x1a\x6a\xd1\x48\x8a\x40\x45\x86\xc0\x6a\x28\x18\x45\x5e\x63\x06\x0d\xcf\x50\x82\x5a\x23\x5c\x55\x84\xae\x11\x2e\xe3\xf7\xfd\x2d\xe4\xa2\xe1\x59\xc8\xb8\xb9\xff\xed\xe6\xfa\xd3\xed\xdd\x27\xc8\x59\x81\xe0\xce\xa4\x10\x0a\x32\x26\x91\x2a\x21\xb7\x20\x72\x50\x9e\x32\x25\x11\xe3\xf0\x22\xe9\xba\x30\x6c\x5b\xc8\x30\x67\x1c\x21\xaa\xe9\x1a\x4b\x12\x81\x3d\x5e\xc0\x5f\x4c\xad\x01\x5f\x14\xf2\x0c\x66\x10\x7d\x25\x74\x43\x56\x18\x41\x54\xb2\x95\x24\x0a\x23\x58\x74\x5d\x18\xb4\x2d\x28\x2c\xab\x82\x28\x84\x68\x8d\x24\x43\x19\x41\xac\xa5\xb4\x2d\x68\x5e\x2d\x8f\x95\x95\x90\x0a\xde\x1a\x72\x49\xf8\x0a\x61\xf6\xe7\x1c\x66\x1c\xd2\x25\xcc\xe2\x5b\x91\x61\xad\x09\x83\x20\x6a\x5b\x98\xc5\xd7\x82\xe7\x6c\x15\x3b\x9d\xd0\x75\x89\x3e\xe6\xde\x41\xa4\x45\x2d\x06\x05\x41\xb4\x62\x6a\xdd\x3c\xc6\x54\x94\x49\xee\xc0\x4f\x90\xab\x24\x63\xa4\x40\xaa\xf4\xba\x7e\x2a\xa2\x33\x28\xeb\xa7\x22\x71\x60\x9c\xa0\xb6\x14\x49\xce\xb0\xc8\xa2\xf0\x5d\x18\x3e\x13\x69\x1d\x5c\xf8\x1e\x2a\xeb\xe1\x37\xf2\x58\xf4\x2e\x6a\x8a\xe4\x02\x72\xc6\x33\x50\xdb\x0a\x81\x9b\xe8\xdb\xd0\xad\x24\xa9\xd6\x43\xc4\x94\x66\x9b\x03\xcb\x01\x5f\x58\xad\x6a\x30\x51\xb3\x22\x66\x86\x2d\x5d\x02\xe3\x19\xbe\x0c\x28\xbe\x1f\x95\x1c\x07\xba\x6d\x8d\xcc\x27\x98\xa9\xf8\x96\x94\xa8\xb1\x35\x26\xda\x3b\x2b\x7a\xa9\xd9\xcc\xde\xa2\x3c\xc6\xd3\x19\x40\x45\xd1\x94\xbc\xd6\xa2\x2b\x52\x53\x52\x0c\xe2\xfe\x81\x4a\x32\xae\x72\x88\x7e\xa9\xaf\x2d\x55\x64\x19\x93\x04\xb4\x82\x9e\xb5\xeb\x60\x2d\x8a\xac\x36\xbe\xf7\x87\xb9\xb0\xa9\x6f\x72\xc1\x49\xec\xba\xc8\xa2\x11\x1b\xed\x13\x09\x4b\xb8\x7f\xb8\xb0\xf1\x88\xad\xb6\x36\x0c\x26\x10\x50\xe3\xbe\x72\xb7\x2e\x0e\x41\xd0\x82\x96\x9d\x5a\x45\x74\x50\x34\x87\x6f\xdb\x0a\x53\x30\xb1\x8d\xed\x9d\x3e\xd1\x69\x59\x2b\x47\x35\xb7\x12\xda\x85\x46\x72\x46\xe3\xef\x9c\x3d\x35\xfa\x02\xec\x2a\x05\x25\x1b\x9c\xfb\xa0\xf9\xe4\x37\x9c\x4a\x2c\x75\xab\xe8\x3a\x18\x36\xaf\x30\xdd\x36\x45\xe1\xa2\x04\xfd\x3a\x05\x67\xfc\x78\x77\x80\xdf\x14\xf3\x8c\xc6\x77\xec\x6f\xc3\xad\xff\x0d\x67\x7c\x9a\xfe\x4a\x29\xa9\xe9\xf5\xbf\xc5\x29\x36\x08\x1d\xe7\xf8\xc4\x9b\xd2\x44\xc5\x2c\x52\xb8\x7f\xa8\x95\x64\x7c\xd5\xc2\x58\xfa\x26\x6d\x8d\x20\x6d\x3b\x4e\x25\xc2\x29\x7b\x3e\x62\x4e\x9a\xc2\x80\xe6\x96\xe7\x78\x71\x67\x72\x43\x87\xd0\xf8\x3e\xec\x52\x28\x49\x75\x6f\xed\x3b\x60\xe6\x66\x0e\xb3\xe7\x89\xa9\x1b\xbd\x70\xf9\xf2\x3c\x35\x7b\x2c\x0f\x9b\x1a\x5e\x77\x0a\x82\xa1\x64\x4c\x0a\xbf\x52\x30\xa6\x10\xa7\xe5\xa2\xfa\xa8\x8f\xc5\x62\xf3\x1d\x18\xcf\x85\x2c\x89\x62\x82\x9f\x57\x37\x83\xa8\x25\xbc\x71\x35\x63\x14\x9a\x92\xf1\xca\x61\xe4\x37\xee\xb8\xca\x49\x77\xaa\xd7\xdc\x7d\x95\xac\x24\x72\xfb\x05\xb7\xe9\xe1\x4a\xdc\xed\x46\xd5\xc6\xd5\xe3\xc8\xd9\x87\xcd\x27\x65\xf3\xa3\x95\x3b\x54\x85\xee\x61\xd5\xc6\x35\xb1\xa1\x84\xa7\x46\xde\xeb\x2d\x83\xae\x7b\xd8\xc9\x91\x69\x90\x76\xb7\xd6\xb9\xcf\x42\x22\x5b\xf1\x2f\xb8\xad\x7d\xef\xc6\xe3\x83\x1e\xe6\xbd\x87\x1e\xfb\xa8\xd5\xb9\x70\xb7\x2d\x1f\x45\xe1\xf0\xce\x37\xb1\xdd\x0f\x90\xfb\xa8\x1f\x86\x35\x00\xd8\xd3\x4c\x3f\x18\xcd\xf9\x66\x1f\xb2\x7d\x70\x2f\x8f\xa1\x3b\x05\x98\x7e\xe8\x01\xbe\xfc\x51\x84\xf7\x41\x3e\x74\xd2\xcd\x87\xa8\x26\x17\x50\x89\x5a\x55\x82\x23\x48\xcc\x25\x72\xca\xf8\x0a\x94\x00\xf2\x2c\x98\x9d\x98\x74\x8d\x74\xa3\x4f\x0b\x21\xaa\x61\x28\xea\xdf\x1f\x98\xff\x2f\xcc\x46\xfe\xd7\x61\xb3\xe4\xa6\x78\xfe\x1b\x80\x7d\x0f\xf0\x05\x9d\x1a\x9f\x3f\x11\xe5\xbe\x37\xe6\x9b\xf8\x77\xfe\xbd\xca\x88\x9a\x4e\xb7\x5e\x46\x7f\x99\xba\x7e\x13\xf7\xcd\x36\x3c\xa2\x63\x47\xf4\x47\x2c\xf0\xa8\x68\x7b\x79\xae\x68\x6f\xe2\xee\xd6\x68\x3f\x21\x55\x7c\xa3\xdf\x42\x38\xc4\xc1\x6d\xfd\x5c\x30\x47\xed\x5e\xaf\xd1\x69\xc0\xb2\x17\x57\x0f\x3b\x62\xc6\x92\xf5\x3b\x24\xcb\x5e\xa6\x3d\x52\xff\xfa\xe1\xdf\x13\x0c\xcf\x82\x81\xe2\xb5\xfc\xdc\xb7\xcb\xa5\xa7\x16\x77\x2c\xcf\xce\x2d\xea\x9f\x57\xd5\x07\x12\xee\xc0\xd1\xe0\x76\xbf\xd8\x21\x39\x30\x2b\xbd\x14\x22\x5c\x39\x5f\xae\x38\x17\xca\x4e\x39\xc7\x39\x9e\xa4\xf0\xc6\x3e\xee\x3d\x2a\x33\xc6\xb3\xa6\xac\x3e\xeb\x37\x5c\x6d\x45\x99\xb7\xc5\xa1\xd9\xec\xef\x93\x04\xdc\x63\xdd\xce\x5a\x52\x14\x66\xa8\x2a\x7b\xe8\x9e\xe9\x2e\x70\x61\xe0\x68\xfd\x27\xe8\x30\x4e\x5f\xff\x14\x08\xbc\x2e\x70\xea\x25\x30\x0f\xa7\x46\x77\xfa\x83\x23\x6f\x38\x05\xc6\x99\x7a\xfb\x0e\xda\x73\x3f\x3c\x7e\xf8\x05\xb2\x93\x5d\x27\x06\x9b\xff\xba\xf0\xaf\xc7\x34\x1a\xda\x1c\x2c\xe1\xdc\xfe\xb7\x6b\x4b\x0f\x81\xb7\xb6\xdf\xb1\x6e\xf3\x6f\x00\x00\x00\xff\xff\xb0\x6f\xd6\xdb\x96\x0f\x00\x00")
|
||||
|
||||
func templateMigrateSchemaTmplBytes() ([]byte, error) {
|
||||
return bindataRead(
|
||||
@@ -1085,7 +1085,7 @@ func templateMigrateSchemaTmpl() (*asset, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "template/migrate/schema.tmpl", size: 3836, mode: os.FileMode(420), modTime: time.Unix(1, 0)}
|
||||
info := bindataFileInfo{name: "template/migrate/schema.tmpl", size: 3990, mode: os.FileMode(420), modTime: time.Unix(1, 0)}
|
||||
a := &asset{bytes: bytes, info: info}
|
||||
return a, nil
|
||||
}
|
||||
|
||||
@@ -15,8 +15,9 @@ import (
|
||||
"{{ $.Config.Package }}/{{ $n.Package }}"
|
||||
{{- end }}
|
||||
|
||||
"github.com/facebook/ent/schema/field"
|
||||
"github.com/facebook/ent/dialect/entsql"
|
||||
"github.com/facebook/ent/dialect/sql/schema"
|
||||
"github.com/facebook/ent/schema/field"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -96,6 +97,9 @@ var (
|
||||
{{- end }}
|
||||
},
|
||||
{{- end }}
|
||||
{{- with $ant := $t.Annotation }}
|
||||
Annotation: &entsql.Annotation{ {{ dumpFields $ant }} },
|
||||
{{- end }}
|
||||
}
|
||||
{{- end }}
|
||||
// Tables holds all the tables in the schema.
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
package migrate
|
||||
|
||||
import (
|
||||
"github.com/facebook/ent/dialect/entsql"
|
||||
"github.com/facebook/ent/dialect/sql/schema"
|
||||
"github.com/facebook/ent/schema/field"
|
||||
)
|
||||
@@ -22,6 +23,7 @@ var (
|
||||
Columns: UsersColumns,
|
||||
PrimaryKey: []*schema.Column{UsersColumns[0]},
|
||||
ForeignKeys: []*schema.ForeignKey{},
|
||||
Annotation: &entsql.Annotation{Table: "Users", Charset: "utf8mb4"},
|
||||
}
|
||||
// Tables holds all the tables in the schema.
|
||||
Tables = []*schema.Table{
|
||||
|
||||
@@ -8,13 +8,32 @@ import (
|
||||
"github.com/facebook/ent"
|
||||
"github.com/facebook/ent/dialect/entsql"
|
||||
"github.com/facebook/ent/schema"
|
||||
"github.com/facebook/ent/schema/mixin"
|
||||
)
|
||||
|
||||
type Mixin struct {
|
||||
mixin.Schema
|
||||
}
|
||||
|
||||
// Annotations of the Mixin schema.
|
||||
func (Mixin) Annotations() []schema.Annotation {
|
||||
return []schema.Annotation{
|
||||
entsql.Annotation{Charset: "utf8mb4"},
|
||||
}
|
||||
}
|
||||
|
||||
// User holds the schema definition for the User entity.
|
||||
type User struct {
|
||||
ent.Schema
|
||||
}
|
||||
|
||||
// Mixin of the User schema.
|
||||
func (User) Mixin() []ent.Mixin {
|
||||
return []ent.Mixin{
|
||||
Mixin{},
|
||||
}
|
||||
}
|
||||
|
||||
// Annotations of the User schema.
|
||||
func (User) Annotations() []schema.Annotation {
|
||||
return []schema.Annotation{
|
||||
|
||||
Reference in New Issue
Block a user