schema/field: add GoType option for string fields (#500)

This commit is contained in:
Ariel Mashraki
2020-05-25 20:05:17 +03:00
committed by GitHub
parent 31690c7e60
commit 100d300094
58 changed files with 845 additions and 273 deletions

View File

@@ -122,10 +122,11 @@ func NameIn(vs ...string) predicate.City {
for i := range v {
v[i] = vs[i]
}
return predicate.City(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(vs) == 0 {
if len(v) == 0 {
s.Where(sql.False())
return
}
@@ -139,10 +140,11 @@ func NameNotIn(vs ...string) predicate.City {
for i := range v {
v[i] = vs[i]
}
return predicate.City(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(vs) == 0 {
if len(v) == 0 {
s.Where(sql.False())
return
}

View File

@@ -122,10 +122,11 @@ func NameIn(vs ...string) predicate.Street {
for i := range v {
v[i] = vs[i]
}
return predicate.Street(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(vs) == 0 {
if len(v) == 0 {
s.Where(sql.False())
return
}
@@ -139,10 +140,11 @@ func NameNotIn(vs ...string) predicate.Street {
for i := range v {
v[i] = vs[i]
}
return predicate.Street(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(vs) == 0 {
if len(v) == 0 {
s.Where(sql.False())
return
}

View File

@@ -122,10 +122,11 @@ func NameIn(vs ...string) predicate.Group {
for i := range v {
v[i] = vs[i]
}
return predicate.Group(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(vs) == 0 {
if len(v) == 0 {
s.Where(sql.False())
return
}
@@ -139,10 +140,11 @@ func NameNotIn(vs ...string) predicate.Group {
for i := range v {
v[i] = vs[i]
}
return predicate.Group(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(vs) == 0 {
if len(v) == 0 {
s.Where(sql.False())
return
}

View File

@@ -129,10 +129,11 @@ func AgeIn(vs ...int) predicate.User {
for i := range v {
v[i] = vs[i]
}
return predicate.User(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(vs) == 0 {
if len(v) == 0 {
s.Where(sql.False())
return
}
@@ -146,10 +147,11 @@ func AgeNotIn(vs ...int) predicate.User {
for i := range v {
v[i] = vs[i]
}
return predicate.User(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(vs) == 0 {
if len(v) == 0 {
s.Where(sql.False())
return
}
@@ -205,10 +207,11 @@ func NameIn(vs ...string) predicate.User {
for i := range v {
v[i] = vs[i]
}
return predicate.User(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(vs) == 0 {
if len(v) == 0 {
s.Where(sql.False())
return
}
@@ -222,10 +225,11 @@ func NameNotIn(vs ...string) predicate.User {
for i := range v {
v[i] = vs[i]
}
return predicate.User(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(vs) == 0 {
if len(v) == 0 {
s.Where(sql.False())
return
}

View File

@@ -129,10 +129,11 @@ func AgeIn(vs ...int) predicate.User {
for i := range v {
v[i] = vs[i]
}
return predicate.User(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(vs) == 0 {
if len(v) == 0 {
s.Where(sql.False())
return
}
@@ -146,10 +147,11 @@ func AgeNotIn(vs ...int) predicate.User {
for i := range v {
v[i] = vs[i]
}
return predicate.User(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(vs) == 0 {
if len(v) == 0 {
s.Where(sql.False())
return
}
@@ -205,10 +207,11 @@ func NameIn(vs ...string) predicate.User {
for i := range v {
v[i] = vs[i]
}
return predicate.User(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(vs) == 0 {
if len(v) == 0 {
s.Where(sql.False())
return
}
@@ -222,10 +225,11 @@ func NameNotIn(vs ...string) predicate.User {
for i := range v {
v[i] = vs[i]
}
return predicate.User(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(vs) == 0 {
if len(v) == 0 {
s.Where(sql.False())
return
}

View File

@@ -129,10 +129,11 @@ func AgeIn(vs ...int) predicate.User {
for i := range v {
v[i] = vs[i]
}
return predicate.User(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(vs) == 0 {
if len(v) == 0 {
s.Where(sql.False())
return
}
@@ -146,10 +147,11 @@ func AgeNotIn(vs ...int) predicate.User {
for i := range v {
v[i] = vs[i]
}
return predicate.User(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(vs) == 0 {
if len(v) == 0 {
s.Where(sql.False())
return
}
@@ -205,10 +207,11 @@ func NameIn(vs ...string) predicate.User {
for i := range v {
v[i] = vs[i]
}
return predicate.User(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(vs) == 0 {
if len(v) == 0 {
s.Where(sql.False())
return
}
@@ -222,10 +225,11 @@ func NameNotIn(vs ...string) predicate.User {
for i := range v {
v[i] = vs[i]
}
return predicate.User(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(vs) == 0 {
if len(v) == 0 {
s.Where(sql.False())
return
}

View File

@@ -122,10 +122,11 @@ func NameIn(vs ...string) predicate.Pet {
for i := range v {
v[i] = vs[i]
}
return predicate.Pet(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(vs) == 0 {
if len(v) == 0 {
s.Where(sql.False())
return
}
@@ -139,10 +140,11 @@ func NameNotIn(vs ...string) predicate.Pet {
for i := range v {
v[i] = vs[i]
}
return predicate.Pet(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(vs) == 0 {
if len(v) == 0 {
s.Where(sql.False())
return
}

View File

@@ -129,10 +129,11 @@ func AgeIn(vs ...int) predicate.User {
for i := range v {
v[i] = vs[i]
}
return predicate.User(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(vs) == 0 {
if len(v) == 0 {
s.Where(sql.False())
return
}
@@ -146,10 +147,11 @@ func AgeNotIn(vs ...int) predicate.User {
for i := range v {
v[i] = vs[i]
}
return predicate.User(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(vs) == 0 {
if len(v) == 0 {
s.Where(sql.False())
return
}
@@ -205,10 +207,11 @@ func NameIn(vs ...string) predicate.User {
for i := range v {
v[i] = vs[i]
}
return predicate.User(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(vs) == 0 {
if len(v) == 0 {
s.Where(sql.False())
return
}
@@ -222,10 +225,11 @@ func NameNotIn(vs ...string) predicate.User {
for i := range v {
v[i] = vs[i]
}
return predicate.User(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(vs) == 0 {
if len(v) == 0 {
s.Where(sql.False())
return
}

View File

@@ -122,10 +122,11 @@ func ValueIn(vs ...int) predicate.Node {
for i := range v {
v[i] = vs[i]
}
return predicate.Node(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(vs) == 0 {
if len(v) == 0 {
s.Where(sql.False())
return
}
@@ -139,10 +140,11 @@ func ValueNotIn(vs ...int) predicate.Node {
for i := range v {
v[i] = vs[i]
}
return predicate.Node(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(vs) == 0 {
if len(v) == 0 {
s.Where(sql.False())
return
}

View File

@@ -131,10 +131,11 @@ func ExpiredIn(vs ...time.Time) predicate.Card {
for i := range v {
v[i] = vs[i]
}
return predicate.Card(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(vs) == 0 {
if len(v) == 0 {
s.Where(sql.False())
return
}
@@ -148,10 +149,11 @@ func ExpiredNotIn(vs ...time.Time) predicate.Card {
for i := range v {
v[i] = vs[i]
}
return predicate.Card(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(vs) == 0 {
if len(v) == 0 {
s.Where(sql.False())
return
}
@@ -207,10 +209,11 @@ func NumberIn(vs ...string) predicate.Card {
for i := range v {
v[i] = vs[i]
}
return predicate.Card(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(vs) == 0 {
if len(v) == 0 {
s.Where(sql.False())
return
}
@@ -224,10 +227,11 @@ func NumberNotIn(vs ...string) predicate.Card {
for i := range v {
v[i] = vs[i]
}
return predicate.Card(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(vs) == 0 {
if len(v) == 0 {
s.Where(sql.False())
return
}

View File

@@ -129,10 +129,11 @@ func AgeIn(vs ...int) predicate.User {
for i := range v {
v[i] = vs[i]
}
return predicate.User(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(vs) == 0 {
if len(v) == 0 {
s.Where(sql.False())
return
}
@@ -146,10 +147,11 @@ func AgeNotIn(vs ...int) predicate.User {
for i := range v {
v[i] = vs[i]
}
return predicate.User(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(vs) == 0 {
if len(v) == 0 {
s.Where(sql.False())
return
}
@@ -205,10 +207,11 @@ func NameIn(vs ...string) predicate.User {
for i := range v {
v[i] = vs[i]
}
return predicate.User(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(vs) == 0 {
if len(v) == 0 {
s.Where(sql.False())
return
}
@@ -222,10 +225,11 @@ func NameNotIn(vs ...string) predicate.User {
for i := range v {
v[i] = vs[i]
}
return predicate.User(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(vs) == 0 {
if len(v) == 0 {
s.Where(sql.False())
return
}

View File

@@ -129,10 +129,11 @@ func AgeIn(vs ...int) predicate.User {
for i := range v {
v[i] = vs[i]
}
return predicate.User(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(vs) == 0 {
if len(v) == 0 {
s.Where(sql.False())
return
}
@@ -146,10 +147,11 @@ func AgeNotIn(vs ...int) predicate.User {
for i := range v {
v[i] = vs[i]
}
return predicate.User(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(vs) == 0 {
if len(v) == 0 {
s.Where(sql.False())
return
}
@@ -205,10 +207,11 @@ func NameIn(vs ...string) predicate.User {
for i := range v {
v[i] = vs[i]
}
return predicate.User(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(vs) == 0 {
if len(v) == 0 {
s.Where(sql.False())
return
}
@@ -222,10 +225,11 @@ func NameNotIn(vs ...string) predicate.User {
for i := range v {
v[i] = vs[i]
}
return predicate.User(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(vs) == 0 {
if len(v) == 0 {
s.Where(sql.False())
return
}

View File

@@ -122,10 +122,11 @@ func ValueIn(vs ...int) predicate.Node {
for i := range v {
v[i] = vs[i]
}
return predicate.Node(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(vs) == 0 {
if len(v) == 0 {
s.Where(sql.False())
return
}
@@ -139,10 +140,11 @@ func ValueNotIn(vs ...int) predicate.Node {
for i := range v {
v[i] = vs[i]
}
return predicate.Node(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(vs) == 0 {
if len(v) == 0 {
s.Where(sql.False())
return
}

View File

@@ -131,10 +131,11 @@ func ModelIn(vs ...string) predicate.Car {
for i := range v {
v[i] = vs[i]
}
return predicate.Car(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(vs) == 0 {
if len(v) == 0 {
s.Where(sql.False())
return
}
@@ -148,10 +149,11 @@ func ModelNotIn(vs ...string) predicate.Car {
for i := range v {
v[i] = vs[i]
}
return predicate.Car(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(vs) == 0 {
if len(v) == 0 {
s.Where(sql.False())
return
}
@@ -242,10 +244,11 @@ func RegisteredAtIn(vs ...time.Time) predicate.Car {
for i := range v {
v[i] = vs[i]
}
return predicate.Car(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(vs) == 0 {
if len(v) == 0 {
s.Where(sql.False())
return
}
@@ -259,10 +262,11 @@ func RegisteredAtNotIn(vs ...time.Time) predicate.Car {
for i := range v {
v[i] = vs[i]
}
return predicate.Car(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(vs) == 0 {
if len(v) == 0 {
s.Where(sql.False())
return
}

View File

@@ -122,10 +122,11 @@ func NameIn(vs ...string) predicate.Group {
for i := range v {
v[i] = vs[i]
}
return predicate.Group(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(vs) == 0 {
if len(v) == 0 {
s.Where(sql.False())
return
}
@@ -139,10 +140,11 @@ func NameNotIn(vs ...string) predicate.Group {
for i := range v {
v[i] = vs[i]
}
return predicate.Group(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(vs) == 0 {
if len(v) == 0 {
s.Where(sql.False())
return
}

View File

@@ -129,10 +129,11 @@ func AgeIn(vs ...int) predicate.User {
for i := range v {
v[i] = vs[i]
}
return predicate.User(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(vs) == 0 {
if len(v) == 0 {
s.Where(sql.False())
return
}
@@ -146,10 +147,11 @@ func AgeNotIn(vs ...int) predicate.User {
for i := range v {
v[i] = vs[i]
}
return predicate.User(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(vs) == 0 {
if len(v) == 0 {
s.Where(sql.False())
return
}
@@ -205,10 +207,11 @@ func NameIn(vs ...string) predicate.User {
for i := range v {
v[i] = vs[i]
}
return predicate.User(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(vs) == 0 {
if len(v) == 0 {
s.Where(sql.False())
return
}
@@ -222,10 +225,11 @@ func NameNotIn(vs ...string) predicate.User {
for i := range v {
v[i] = vs[i]
}
return predicate.User(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(vs) == 0 {
if len(v) == 0 {
s.Where(sql.False())
return
}

View File

@@ -122,10 +122,11 @@ func NameIn(vs ...string) predicate.Group {
for i := range v {
v[i] = vs[i]
}
return predicate.Group(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(vs) == 0 {
if len(v) == 0 {
s.Where(sql.False())
return
}
@@ -139,10 +140,11 @@ func NameNotIn(vs ...string) predicate.Group {
for i := range v {
v[i] = vs[i]
}
return predicate.Group(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(vs) == 0 {
if len(v) == 0 {
s.Where(sql.False())
return
}

View File

@@ -122,10 +122,11 @@ func NameIn(vs ...string) predicate.Pet {
for i := range v {
v[i] = vs[i]
}
return predicate.Pet(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(vs) == 0 {
if len(v) == 0 {
s.Where(sql.False())
return
}
@@ -139,10 +140,11 @@ func NameNotIn(vs ...string) predicate.Pet {
for i := range v {
v[i] = vs[i]
}
return predicate.Pet(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(vs) == 0 {
if len(v) == 0 {
s.Where(sql.False())
return
}

View File

@@ -129,10 +129,11 @@ func AgeIn(vs ...int) predicate.User {
for i := range v {
v[i] = vs[i]
}
return predicate.User(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(vs) == 0 {
if len(v) == 0 {
s.Where(sql.False())
return
}
@@ -146,10 +147,11 @@ func AgeNotIn(vs ...int) predicate.User {
for i := range v {
v[i] = vs[i]
}
return predicate.User(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(vs) == 0 {
if len(v) == 0 {
s.Where(sql.False())
return
}
@@ -205,10 +207,11 @@ func NameIn(vs ...string) predicate.User {
for i := range v {
v[i] = vs[i]
}
return predicate.User(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(vs) == 0 {
if len(v) == 0 {
s.Where(sql.False())
return
}
@@ -222,10 +225,11 @@ func NameNotIn(vs ...string) predicate.User {
for i := range v {
v[i] = vs[i]
}
return predicate.User(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(vs) == 0 {
if len(v) == 0 {
s.Where(sql.False())
return
}