Documentation
¶
Index ¶
- func And(fo, so model.Operation) model.Operation
- func Equals[T any, A *T | **T](a A, v T) model.Operation
- func EqualsArg[T any, A *T | **T](a A, v A) model.Operation
- func Greater[T any, A *T | **T](a A, v T) model.Operation
- func GreaterArg[T any, A *T | **T](a A, v A) model.Operation
- func GreaterEquals[T any, A *T | **T](a A, v T) model.Operation
- func GreaterEqualsArg[T any, A *T | **T](a A, v A) model.Operation
- func In[T any, V []T | model.Query](a *T, mq V) model.Operation
- func Less[T any, A *T | **T](a A, v T) model.Operation
- func LessArg[T any, A *T | **T](a A, v A) model.Operation
- func LessEquals[T any, A *T | **T](a A, v T) model.Operation
- func LessEqualsArg[T any, A *T | **T](a A, v A) model.Operation
- func Like[T any](a *T, v string) model.Operation
- func NotEquals[T any, A *T | **T](a A, v T) model.Operation
- func NotEqualsArg[T any, A *T | **T](a A, v A) model.Operation
- func NotIn[T any, V []T | model.Query](a *T, mq V) model.Operation
- func NotLike[T any](a *T, v string) model.Operation
- func Or(fo, so model.Operation) model.Operation
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func And ¶
Example ¶
Where( where.And( where.Equals(&db.Animal.Status, "Eating"), where.Like(&db.Animal.Name, "%Cat%"), ), )
func Equals ¶
Example ¶
// match Food with Id fc1865b4-6f2d-4cc6-b766-49c2634bf5c4 Where(where.Equals(&db.Food.Id, "fc1865b4-6f2d-4cc6-b766-49c2634bf5c4")) // generate: WHERE "animals"."idhabitat" IS NULL var idHabitat *string Where(where.Equals(&db.Animal.IdHabitat, idHabitat))
func EqualsArg ¶
Example ¶
// implicit join using EqualsArg goe.Select(db.Animal). Where( where.And( where.EqualsArg[int](&db.Animal.Id, &db.AnimalFood.IdAnimal), where.EqualsArg[uuid.UUID](&db.Food.Id, &db.AnimalFood.IdFood), ), ).AsSlice()
func Greater ¶
Example ¶
// get all animals that was created after 09 of october 2024 at 11:50AM Where(where.Greater(&db.Animal.CreateAt, time.Date(2024, time.October, 9, 11, 50, 00, 00, time.Local)))
func GreaterEquals ¶
Example ¶
// get all animals that was created in or after 09 of october 2024 at 11:50AM Where(where.GreaterEquals(&db.Animal.CreateAt, time.Date(2024, time.October, 9, 11, 50, 00, 00, time.Local)))
func GreaterEqualsArg ¶
Example ¶
Where(where.GreaterEqualsArg(&db.Drinks.Reorder, &db.Drinks.Stock))
func In ¶
Example ¶
// where in using a slice
Where(where.In(&db.Animal.Name, []string{"Cat", "Dog"}))
// AsQuery for get the query result from a select query
querySelect := goe.Select[any](&struct{ Name *string }{Name: &db.Animal.Name}).AsQuery()
// Use querySelect on in
rows, err := goe.Select(db.Animal).Where(where.In(&db.Animal.Name, querySelect).AsSlice()
func Less ¶
Example ¶
// get all animals that was updated before 09 of october 2024 at 11:50AM Where(where.Less(&db.Animal.UpdateAt, time.Date(2024, time.October, 9, 11, 50, 00, 00, time.Local)))
func LessEquals ¶
Example ¶
// get all animals that was updated in or before 09 of october 2024 at 11:50AM Where(where.LessEquals(&db.Animal.UpdateAt, time.Date(2024, time.October, 9, 11, 50, 00, 00, time.Local)))
func Like ¶
Example ¶
// get all animals that has a "at" in his name Where(where.Like(&db.Animal.Name, "%at%"))
func NotEquals ¶
Example ¶
// match all foods that name are not Cookie Where(where.NotEquals(&db.Food.Name, "Cookie")) // generate: WHERE "animals"."idhabitat" IS NOT NULL var idHabitat *string Where(where.NotEquals(&db.Animal.IdHabitat, idHabitat))
func NotIn ¶
Example ¶
// where not in using a slice
Where(where.NotIn(&db.Animal.Name, []string{"Cat", "Dog"}))
// AsQuery for get the query result from a select query
querySelect, err := goe.Select(&struct{ Name *string }{Name: &db.Animal.Name}).AsQuery()
// Use querySelect on not in
rows, err := goe.Select(db.Animal).Where(where.NotIn(&db.Animal.Name, querySelect).AsSlice()
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.