Documentation ¶
Index ¶
- Variables
- func IDField(name string) *fieldBuilder
- func IDHook() ent.Hook
- type ID
- type Refer
- func (i Refer) Extract(idx int) ReferSegment
- func (i Refer) ID() ID
- func (i Refer) Int() int
- func (i Refer) Int64() int64
- func (i Refer) IsComposited(keyLength int) bool
- func (i Refer) IsID() bool
- func (i Refer) IsNumeric() bool
- func (i Refer) IsString() bool
- func (i Refer) Split(length int) ReferSegments
- func (i Refer) String() string
- type ReferSegment
- type ReferSegments
Constants ¶
This section is empty.
Variables ¶
View Source
var Config = vars.SetOnce[sonyflake.Settings]{}
Config holds the config of the object.ID generation.
Functions ¶
Types ¶
type ID ¶
type ID string
ID shows the primary key in string but stores in big integer, also be good at catching composited primary keys.
type Refer ¶
type Refer string
func (Refer) Extract ¶
func (i Refer) Extract(idx int) ReferSegment
Extract extracts the index segment of the composited key with default separator into an array, it should be called after IsNumeric == false or IsComposited == true.
func (Refer) IsComposited ¶
IsComposited returns true if the given Refer is a composited value, combines with several fields of the object. E.g. X:y:z.
func (Refer) Split ¶
func (i Refer) Split(length int) ReferSegments
Split splits the composited key with default separator into an array, it should be called after IsNumeric == false or IsComposited == true.
type ReferSegment ¶
type ReferSegment string
func (ReferSegment) Bool ¶
func (i ReferSegment) Bool() bool
func (ReferSegment) ID ¶
func (i ReferSegment) ID() ID
func (ReferSegment) Int ¶
func (i ReferSegment) Int() int
func (ReferSegment) Int64 ¶
func (i ReferSegment) Int64() int64
func (ReferSegment) String ¶
func (i ReferSegment) String() string
type ReferSegments ¶
type ReferSegments []ReferSegment
func (ReferSegments) Index ¶
func (i ReferSegments) Index(idx int) ReferSegment
Index gets the segment with the given order.
Click to show internal directories.
Click to hide internal directories.