-
Notifications
You must be signed in to change notification settings - Fork 0
/
belongsto_owned.go
42 lines (36 loc) · 1.96 KB
/
belongsto_owned.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// Code generated by badaas-cli v0.0.0, DO NOT EDIT.
package conditions
import (
condition "github.com/FrancoLiberali/cql/condition"
model "github.com/FrancoLiberali/cql/model"
belongsto "github.com/FrancoLiberali/cql/cli/cmd/gen/conditions/tests/belongsto"
"time"
)
func (ownedConditions ownedConditions) Owner(conditions ...condition.Condition[belongsto.Owner]) condition.JoinCondition[belongsto.Owned] {
return condition.NewJoinCondition[belongsto.Owned, belongsto.Owner](conditions, "Owner", "OwnerID", ownedConditions.Preload(), "ID")
}
func (ownedConditions ownedConditions) PreloadOwner() condition.JoinCondition[belongsto.Owned] {
return ownedConditions.Owner(Owner.Preload())
}
type ownedConditions struct {
ID condition.Field[belongsto.Owned, model.UUID]
CreatedAt condition.Field[belongsto.Owned, time.Time]
UpdatedAt condition.Field[belongsto.Owned, time.Time]
DeletedAt condition.Field[belongsto.Owned, time.Time]
OwnerID condition.Field[belongsto.Owned, model.UUID]
}
var Owned = ownedConditions{
CreatedAt: condition.Field[belongsto.Owned, time.Time]{Name: "CreatedAt"},
DeletedAt: condition.Field[belongsto.Owned, time.Time]{Name: "DeletedAt"},
ID: condition.Field[belongsto.Owned, model.UUID]{Name: "ID"},
OwnerID: condition.Field[belongsto.Owned, model.UUID]{Name: "OwnerID"},
UpdatedAt: condition.Field[belongsto.Owned, time.Time]{Name: "UpdatedAt"},
}
// Preload allows preloading the Owned when doing a query
func (ownedConditions ownedConditions) Preload() condition.Condition[belongsto.Owned] {
return condition.NewPreloadCondition[belongsto.Owned](ownedConditions.ID, ownedConditions.CreatedAt, ownedConditions.UpdatedAt, ownedConditions.DeletedAt, ownedConditions.OwnerID)
}
// PreloadRelations allows preloading all the Owned's relation when doing a query
func (ownedConditions ownedConditions) PreloadRelations() []condition.Condition[belongsto.Owned] {
return []condition.Condition[belongsto.Owned]{ownedConditions.PreloadOwner()}
}