Documentation
¶
Index ¶
- Variables
- type BoolMixin
- type BusinessFlowMixin
- type BusinessTagMixin
- type CustomPrimaryKey
- type DataTrackingMixin
- type FormBaseMixin
- type IDMixin
- type IntField
- type JSONMixin
- type NodeBaseMixin
- type OperatorBy
- type PermissionMixin
- type PrimaryKeyAlias
- type ProcessRefMixin
- type StringMixin
- type TaskAssigneeMixin
- type TextMixin
- type TimeAt
- type TimeMixin
- type TimeTrackingMixin
- type WorkflowControlMixin
Constants ¶
This section is empty.
Variables ¶
var ( Default = BoolMixin{Field: "default", Comment: "is default", Optional: true} Markdown = BoolMixin{Field: "markdown", Comment: "is markdown", Optional: true} Temp = BoolMixin{Field: "temp", Comment: "is temp", Optional: true} Private = BoolMixin{Field: "private", Comment: "is private", Optional: true} Approved = BoolMixin{Field: "approved", Comment: "is approved", Optional: true} Disabled = BoolMixin{Field: "disabled", Comment: "is disabled", Optional: true} Logged = BoolMixin{Field: "logged", Comment: "is logged", Optional: true} System = BoolMixin{Field: "system", Comment: "is system", Optional: true} Hidden = BoolMixin{Field: "hidden", Comment: "is hidden", Optional: true} IsCertified = BoolMixin{Field: "is_certified", Comment: "is certified", Optional: true} IsAdmin = BoolMixin{Field: "is_admin", Comment: "is admin", Optional: true} Autoload = BoolMixin{Field: "autoload", Comment: "Whether to load the option automatically", Default: true, Optional: true} Read = BoolMixin{Field: "read", Comment: "is read", Optional: true} ReadWrite = BoolMixin{Field: "read_write", Comment: "is read write", Optional: true} Write = BoolMixin{Field: "write", Comment: "is write", Optional: true} )
Specific mixins can be created using the generic BoolMixin.
var ( Status = IntField{Field: "status", Comment: "status: 0 activated, 1 unactivated, 2 disabled", Default: 0} Order = IntField{Field: "order", Comment: "display order", Default: 0} Size = IntField{Field: "size", Comment: "size in bytes", Default: 0} IncrementStep = IntField{Field: "increment_step", Comment: "Increment step", Default: 1} StartValue = IntField{Field: "start_value", Comment: "Start value", Default: 1} CurrentValue = IntField{Field: "current_value", Comment: "Current value", Default: 0} RetryLimit = IntField{Field: "retry_limit", Comment: "max retry times", Default: 0} RetryDelay = IntField{Field: "retry_delay", Comment: "retry delay in seconds", Default: 0} RemindTime = IntField{Field: "remind_time", Comment: "remind time before due", Default: 0} )
Specific mixins can be created using the generic BoolMixin.
var ( ExtraProps = JSONMixin{Field: "extras", Default: types.JSON{}, Comment: "Extend properties", Optional: true} Author = JSONMixin{Field: "author", Default: types.JSON{}, Comment: "Author information, e.g., {id: '', name: '', avatar: '', url: '', email: '', ip: ''}", Optional: true} Related = JSONMixin{Field: "related", Default: types.JSON{}, Comment: "Related entity information, e.g., {id: '', name: '', type: 'user / topic /...'}", Optional: true} Leader = JSONMixin{Field: "leader", Default: types.JSON{}, Comment: "Leader information, e.g., {id: '', name: '', avatar: '', url: '', email: '', ip: ''}", Optional: true} Links = JSONMixin{Field: "links", Default: types.JSONArray{}, Comment: "List of social links or profile links", Optional: true} Payload = JSONMixin{Field: "payload", Default: types.JSON{}, Comment: "Payload", Optional: true} Metadata = JSONMixin{Field: "metadata", Default: types.JSON{}, Comment: "Metadata", Optional: true} )
Specific mixins can be created using the generic JSONMixin.
var ( UserID = IDMixin{Field: "user_id", Comment: "user id"} RoleID = IDMixin{Field: "role_id", Comment: "role id"} PermissionID = IDMixin{Field: "permission_id", Comment: "permission id"} GroupID = IDMixin{Field: "group_id", Comment: "group id"} DictionaryID = IDMixin{Field: "dictionary_id", Comment: "dictionary id"} OptionID = IDMixin{Field: "option_id", Comment: "option id"} MenuID = IDMixin{Field: "menu_id", Comment: "menu id"} OrgID = IDMixin{Field: "org_id", Comment: "organization id"} ParentID = IDMixin{Field: "parent_id", Comment: "parent id"} TopicID = IDMixin{Field: "topic_id", Comment: "topic id"} ReplyToMixin = IDMixin{Field: "reply_to", Comment: "reply to object id"} TaxonomyID = IDMixin{Field: "taxonomy_id", Comment: "taxonomy id"} StoreID = IDMixin{Field: "store_id", Comment: "store id"} CatalogID = IDMixin{Field: "catalog_id", Comment: "catalog id"} ObjectID = IDMixin{Field: "object_id", Comment: "object id"} OAuthID = IDMixin{Field: "oauth_id", Comment: "oauth id"} ChannelID = IDMixin{Field: "channel_id", Comment: "channel id"} OwnerID = IDMixin{Field: "owner_id", Comment: "owner id"} SpaceID = IDMixin{Field: "space_id", Comment: "space id, e.g. space id, organization id, store id"} )
Specific mixins can be created using the generic IDMixin.
var ( TextStatus = StringMixin{Field: "status", Comment: "Status, text status", Optional: true} Email = StringMixin{Field: "email", Comment: "email", Optional: true} Username = StringMixin{Field: "username", Comment: "username", Optional: true} UsernameUnique = StringMixin{Field: "username", Comment: "username", Unique: true, NotEmpty: true, Optional: true, MaxLen: 50, MatchRegex: regexp.MustCompile("^[a-zA-Z0-9._-]{3,50}$")} Password = StringMixin{Field: "password", Comment: "password", Sensitive: true, Optional: true} Secret = StringMixin{Field: "secret", Comment: "secret key", Optional: true} Phone = StringMixin{Field: "phone", Comment: "phone", Optional: true} BankName = StringMixin{Field: "bank_name", Comment: "bank name", Optional: true} CardNo = StringMixin{Field: "card_no", Comment: "card no", Optional: true} CCV = StringMixin{Field: "ccv", Comment: "ccv", Optional: true} Province = StringMixin{Field: "province", Comment: "province", Optional: true} ZipCode = StringMixin{Field: "zip_code", Comment: "zip code", Optional: true} City = StringMixin{Field: "city", Comment: "city", Optional: true} District = StringMixin{Field: "district", Comment: "district", Optional: true} Address = StringMixin{Field: "address", Comment: "address", Optional: true} FirstName = StringMixin{Field: "first_name", Comment: "first name", Optional: true} LastName = StringMixin{Field: "last_name", Comment: "last name", Optional: true} DisplayName = StringMixin{Field: "display_name", Comment: "display name", Optional: true} Language = StringMixin{Field: "language", Comment: "language", Optional: true} About = StringMixin{Field: "about", Comment: "about", Optional: true} Identifier = StringMixin{Field: "identifier", Comment: "Identifier", Optional: true, NotEmpty: true} Name = StringMixin{Field: "name", Comment: "name", Optional: true} NameUnique = StringMixin{Field: "name", Comment: "name", Unique: true, NotEmpty: true, Optional: true} Prefix = StringMixin{Field: "prefix", Comment: "prefix", Optional: true} Suffix = StringMixin{Field: "suffix", Comment: "suffix", Optional: true} Label = StringMixin{Field: "label", Comment: "label", Optional: true} Code = StringMixin{Field: "code", Comment: "code", Optional: true} Slug = StringMixin{Field: "slug", Comment: "slug / alias", Optional: true} SlugUnique = StringMixin{Field: "slug", Comment: "slug / alias", Unique: true, Optional: true} Cover = StringMixin{Field: "cover", Comment: "cover", Optional: true} Thumbnail = StringMixin{Field: "thumbnail", Comment: "thumbnail", Optional: true} Path = StringMixin{Field: "path", Comment: "path", Optional: true} Target = StringMixin{Field: "target", Comment: "target", Optional: true} URL = StringMixin{Field: "url", Comment: "url, website / link...", Optional: true} Icon = StringMixin{Field: "icon", Comment: "icon", Optional: true} Perms = StringMixin{Field: "perms", Comment: "perms", Optional: true} Color = StringMixin{Field: "color", Comment: "color", Optional: true} Content = StringMixin{Field: "content", Comment: "content, big text", Optional: true} Keywords = StringMixin{Field: "keywords", Comment: "keywords", Optional: true} Copyright = StringMixin{Field: "copyright", Comment: "copyright", Optional: true} Logo = StringMixin{Field: "logo", Comment: "logo", Optional: true} LogoAlt = StringMixin{Field: "logo_alt", Comment: "logo alt", Optional: true} Type = StringMixin{Field: "type", Comment: "type", Optional: true} Storage = StringMixin{Field: "storage", Comment: "storage type", Optional: true} Bucket = StringMixin{Field: "bucket", Comment: "bucket", Optional: true} Endpoint = StringMixin{Field: "endpoint", Comment: "endpoint", Optional: true} Action = StringMixin{Field: "action", Comment: "action", Optional: true} Subject = StringMixin{Field: "subject", Comment: "subject", Optional: true} Provider = StringMixin{Field: "provider", Comment: "provider", Optional: true} AccessToken = StringMixin{Field: "access_token", Comment: "access token", NotEmpty: true} RefreshToken = StringMixin{Field: "refresh_token", Comment: "refresh token", NotEmpty: true} SessionID = StringMixin{Field: "session_id", Comment: "session id", Optional: true} ShortBio = StringMixin{Field: "short_bio", Comment: "short bio", Optional: true} Bio = StringMixin{Field: "bio", Comment: "bio", Optional: true} Hash = StringMixin{Field: "hash", Comment: "hash", Optional: true} Title = StringMixin{Field: "title", Comment: "title", Optional: true} Caption = StringMixin{Field: "caption", Comment: "caption", Optional: true} MediaType = StringMixin{Field: "mime", Comment: "resource type", Optional: true} ExtensionName = StringMixin{Field: "ext", Comment: "extension name", Optional: true} Memo = StringMixin{Field: "memo", Comment: "Memo, big text", Optional: true} Remark = StringMixin{Field: "remark", Comment: "Remark, big text", Optional: true} PType = StringMixin{Field: "p_type", Comment: "permission type", Optional: true} Version = StringMixin{Field: "version", Comment: "Version", Optional: true} V0 = StringMixin{Field: "v0", Comment: "version 0", Optional: true} V1 = StringMixin{Field: "v1", Comment: "version 1", Optional: true} V2 = StringMixin{Field: "v2", Comment: "version 2", Optional: true} V3 = StringMixin{Field: "v3", Comment: "version 3", Optional: true} V4 = StringMixin{Field: "v4", Comment: "version 4", Optional: true} V5 = StringMixin{Field: "v5", Comment: "version 5", Optional: true} V6 = StringMixin{Field: "v6", Comment: "version 6", Optional: true} V7 = StringMixin{Field: "v7", Comment: "version 7", Optional: true} CreatedBy = StringMixin{Field: "created_by", Comment: "id of the creator", Optional: true} UpdatedBy = StringMixin{Field: "updated_by", Comment: "id of the last updater", Optional: true} DeletedBy = StringMixin{Field: "deleted_by", Comment: "id of the deleter", Optional: true} Details = StringMixin{Field: "details", Comment: "details", Optional: true} OwnerType = StringMixin{Field: "owner_type", Comment: "owner type, like user or group", Optional: true} SpaceType = StringMixin{Field: "space_type", Comment: "space type, like tenant or space or project", Optional: true} )
Specific mixins can be created using the generic StringMixin.
var ( Value = TextMixin{Field: "value", Comment: "value", Optional: true} Description = TextMixin{Field: "description", Comment: "description", Optional: true} )
Specific mixins can be created using the generic TextMixin.
var ( CreatedAt = TimeMixin{ Field: "created_at", Comment: "created at", Default: func() int64 { return time.Now().UnixMilli() }, Immutable: true, Optional: true, } UpdatedAt = TimeMixin{ Field: "updated_at", Comment: "updated at", Default: func() int64 { return time.Now().UnixMilli() }, UpdateDefault: func() int64 { return time.Now().UnixMilli() }, Optional: true, } DeletedAt = TimeMixin{Field: "deleted_at", Comment: "deleted at", Optional: true} ExpiredAt = TimeMixin{Field: "expired_at", Comment: "expired at", Optional: true} Expires = TimeMixin{Field: "expires", Comment: "expires", Optional: true} Released = TimeMixin{Field: "released", Comment: "released", Optional: true} StartedAt = TimeMixin{Field: "started_at", Comment: "started time", Default: func() int64 { return time.Now().UnixMilli() }} CompletedAt = TimeMixin{Field: "completed_at", Comment: "completed time", Optional: true} )
Specific mixins can be created using the generic TimeMixin.
var (
Operator = OperatorBy{}
)
Operator Specific mixins can be created using the generic OperatorBy.
var PrimaryKey = StringMixin{ Field: "id", Comment: "primary key", Immutable: true, Unique: true, MaxLen: consts.PrimaryKeySize, DefaultFunc: nanoid.PrimaryKey(), }
Functions ¶
This section is empty.
Types ¶
type BoolMixin ¶
type BoolMixin struct {
mixin.Schema
Field string
Comment string
Default bool
Immutable bool
Optional bool
}
BoolMixin defines a generic boolean field mixin.
type BusinessFlowMixin ¶
BusinessFlowMixin defines common business flow status fields
func (BusinessFlowMixin) Fields ¶
func (BusinessFlowMixin) Fields() []ent.Field
type BusinessTagMixin ¶
BusinessTagMixin defines common business tagging fields
func (BusinessTagMixin) Fields ¶
func (BusinessTagMixin) Fields() []ent.Field
type CustomPrimaryKey ¶ added in v0.1.4
CustomPrimaryKey allows customizing the primary key's length and default function
func NewCustomPrimaryKey ¶ added in v0.1.4
func NewCustomPrimaryKey(length int, defaultFunc func() string) CustomPrimaryKey
NewCustomPrimaryKey creates a new CustomPrimaryKey mixin with specified length and default function
func (CustomPrimaryKey) Fields ¶ added in v0.1.4
func (m CustomPrimaryKey) Fields() []ent.Field
Fields of the custom primary key mixin
func (CustomPrimaryKey) Indexes ¶ added in v0.1.4
func (m CustomPrimaryKey) Indexes() []ent.Index
Indexes of the CustomPrimaryKey
type DataTrackingMixin ¶
DataTrackingMixin defines common data tracking fields
func (DataTrackingMixin) Fields ¶
func (DataTrackingMixin) Fields() []ent.Field
type FormBaseMixin ¶
FormBaseMixin defines common form-related fields
func (FormBaseMixin) Fields ¶
func (FormBaseMixin) Fields() []ent.Field
type NodeBaseMixin ¶
NodeBaseMixin defines common node-related fields
func (NodeBaseMixin) Fields ¶
func (NodeBaseMixin) Fields() []ent.Field
type OperatorBy ¶
OperatorBy combines CreatedBy, UpdatedBy, and DeletedBy fields into a single mixin.
type PermissionMixin ¶
PermissionMixin defines common permission fields
func (PermissionMixin) Fields ¶
func (PermissionMixin) Fields() []ent.Field
type PrimaryKeyAlias ¶
PrimaryKeyAlias adds a primary key alias field.
func NewPrimaryKeyAlias ¶
func NewPrimaryKeyAlias(aliasName, aliasKey string) PrimaryKeyAlias
NewPrimaryKeyAlias creates a new PrimaryKeyAlias mixin with the given alias name and key.
func (PrimaryKeyAlias) Fields ¶
func (m PrimaryKeyAlias) Fields() []ent.Field
Fields of the primary key alias mixin.
func (PrimaryKeyAlias) Indexes ¶
func (m PrimaryKeyAlias) Indexes() []ent.Index
Indexes of the PrimaryKeyAlias.
type ProcessRefMixin ¶
ProcessRefMixin defines common process reference fields
func (ProcessRefMixin) Fields ¶
func (ProcessRefMixin) Fields() []ent.Field
type StringMixin ¶
type StringMixin struct {
mixin.Schema
Field string
Comment string
StorageKey string
Nillable bool
Optional bool
Unique bool
NotEmpty bool
Immutable bool
MaxLen int
MatchRegex *regexp.Regexp
Sensitive bool
DefaultFunc any
Default string
}
StringMixin is a generic mixin for adding various fields.
type TaskAssigneeMixin ¶
TaskAssigneeMixin defines common task assignee fields
func (TaskAssigneeMixin) Fields ¶
func (TaskAssigneeMixin) Fields() []ent.Field
type TextMixin ¶
type TextMixin struct {
mixin.Schema
Field string
Comment string
StorageKey string
Nillable bool
Optional bool
Unique bool
NotEmpty bool
Immutable bool
MaxLen int
MatchRegex *regexp.Regexp
Sensitive bool
DefaultFunc any
}
TextMixin is a generic mixin for adding various fields.
type TimeMixin ¶
type TimeMixin struct {
mixin.Schema
Field string
Comment string
Default func() int64
UpdateDefault func() int64
Optional bool
Immutable bool
}
TimeMixin defines a generic time field mixin.
type TimeTrackingMixin ¶
TimeTrackingMixin defines common time tracking fields
func (TimeTrackingMixin) Fields ¶
func (TimeTrackingMixin) Fields() []ent.Field
type WorkflowControlMixin ¶
WorkflowControlMixin defines common workflow control fields
func (WorkflowControlMixin) Fields ¶
func (WorkflowControlMixin) Fields() []ent.Field