d3orm/orm/entity/relation.go
2024-01-10 02:32:42 +03:00

53 lines
715 B
Go

package entity
type DeleteStrategy int
const (
_ DeleteStrategy = iota
None
Cascade
Nullable
)
func deleteStrategyFromAlias(alias string) DeleteStrategy {
switch alias {
case "cascade":
return Cascade
case "nullable":
return Nullable
default:
return None
}
}
type RelationType int
const (
_ RelationType = iota
Lazy
Eager
SmartLazy
)
func relationTypeFromAlias(alias string) RelationType {
switch alias {
case "lazy":
return Lazy
case "eager":
return Eager
default:
return Lazy
}
}
type Relation interface {
Type() RelationType
DeleteStrategy() DeleteStrategy
RelationWith() Name
Field() *FieldInfo
setField(f *FieldInfo)
fillFromTag(tag *parsedTag, parent *MetaInfo)
}