-
Notifications
You must be signed in to change notification settings - Fork 0
/
hasone_country.go
40 lines (34 loc) · 1.83 KB
/
hasone_country.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
// 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"
hasone "github.com/FrancoLiberali/cql/cli/cmd/gen/conditions/tests/hasone"
"time"
)
func (countryConditions countryConditions) Capital(conditions ...condition.Condition[hasone.City]) condition.JoinCondition[hasone.Country] {
return condition.NewJoinCondition[hasone.Country, hasone.City](conditions, "Capital", "ID", countryConditions.Preload(), "CountryID")
}
func (countryConditions countryConditions) PreloadCapital() condition.JoinCondition[hasone.Country] {
return countryConditions.Capital(City.Preload())
}
type countryConditions struct {
ID condition.Field[hasone.Country, model.UUID]
CreatedAt condition.Field[hasone.Country, time.Time]
UpdatedAt condition.Field[hasone.Country, time.Time]
DeletedAt condition.Field[hasone.Country, time.Time]
}
var Country = countryConditions{
CreatedAt: condition.Field[hasone.Country, time.Time]{Name: "CreatedAt"},
DeletedAt: condition.Field[hasone.Country, time.Time]{Name: "DeletedAt"},
ID: condition.Field[hasone.Country, model.UUID]{Name: "ID"},
UpdatedAt: condition.Field[hasone.Country, time.Time]{Name: "UpdatedAt"},
}
// Preload allows preloading the Country when doing a query
func (countryConditions countryConditions) Preload() condition.Condition[hasone.Country] {
return condition.NewPreloadCondition[hasone.Country](countryConditions.ID, countryConditions.CreatedAt, countryConditions.UpdatedAt, countryConditions.DeletedAt)
}
// PreloadRelations allows preloading all the Country's relation when doing a query
func (countryConditions countryConditions) PreloadRelations() []condition.Condition[hasone.Country] {
return []condition.Condition[hasone.Country]{countryConditions.PreloadCapital()}
}