model

package
v0.0.0-...-e371da1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 16, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AttachmentFieldId        = "id"
	AttachmentFieldName      = "name"
	AttachmentFieldAttaType  = "atta_type"
	AttachmentFieldAttaPath  = "atta_path"
	AttachmentFieldCreatedAt = "created_at"
)
View Source
const (
	JournalFieldId            = "id"
	JournalFieldAction        = "action"
	JournalFieldParams        = "params"
	JournalFieldTriggerUserId = "trigger_user_id"
	JournalFieldCreatedAt     = "created_at"
)
View Source
const (
	ShareFieldId           = "id"
	ShareFieldSubject      = "subject"
	ShareFieldDescription  = "description"
	ShareFieldSubjectType  = "subject_type"
	ShareFieldStatus       = "status"
	ShareFieldShareUser    = "share_user"
	ShareFieldShareUserId  = "share_user_id"
	ShareFieldCreateUserId = "create_user_id"
	ShareFieldNote         = "note"
	ShareFieldLikeCount    = "like_count"
	ShareFieldJoinCount    = "join_count"
	ShareFieldAttachments  = "attachments"
	ShareFieldShareAt      = "share_at"
	ShareFieldCreatedAt    = "created_at"
	ShareFieldUpdatedAt    = "updated_at"
	ShareFieldDeletedAt    = "deleted_at"
)
View Source
const (
	SharePlanFieldId           = "id"
	SharePlanFieldShareId      = "share_id"
	SharePlanFieldShareAt      = "share_at"
	SharePlanFieldShareRoom    = "share_room"
	SharePlanFieldPlanDuration = "plan_duration"
	SharePlanFieldRealDuration = "real_duration"
	SharePlanFieldNote         = "note"
	SharePlanFieldCreatedAt    = "created_at"
	SharePlanFieldUpdatedAt    = "updated_at"
)
View Source
const (
	ShareUserRelFieldId        = "id"
	ShareUserRelFieldShareId   = "share_id"
	ShareUserRelFieldUserId    = "user_id"
	ShareUserRelFieldRelType   = "rel_type"
	ShareUserRelFieldCreatedAt = "created_at"
)
View Source
const (
	UserFieldId        = "id"
	UserFieldUuid      = "uuid"
	UserFieldName      = "name"
	UserFieldAccount   = "account"
	UserFieldStatus    = "status"
	UserFieldPassword  = "password"
	UserFieldCreatedAt = "created_at"
	UserFieldUpdatedAt = "updated_at"
)

Variables

This section is empty.

Functions

func AddGlobalScopeForAttachment

func AddGlobalScopeForAttachment(name string, apply func(builder query.Condition))

AddGlobalScopeForAttachment assign a global scope to a model

func AddGlobalScopeForJournal

func AddGlobalScopeForJournal(name string, apply func(builder query.Condition))

AddGlobalScopeForJournal assign a global scope to a model

func AddGlobalScopeForShare

func AddGlobalScopeForShare(name string, apply func(builder query.Condition))

AddGlobalScopeForShare assign a global scope to a model

func AddGlobalScopeForSharePlan

func AddGlobalScopeForSharePlan(name string, apply func(builder query.Condition))

AddGlobalScopeForSharePlan assign a global scope to a model

func AddGlobalScopeForShareUserRel

func AddGlobalScopeForShareUserRel(name string, apply func(builder query.Condition))

AddGlobalScopeForShareUserRel assign a global scope to a model

func AddGlobalScopeForUser

func AddGlobalScopeForUser(name string, apply func(builder query.Condition))

AddGlobalScopeForUser assign a global scope to a model

func AddLocalScopeForAttachment

func AddLocalScopeForAttachment(name string, apply func(builder query.Condition))

AddLocalScopeForAttachment assign a local scope to a model

func AddLocalScopeForJournal

func AddLocalScopeForJournal(name string, apply func(builder query.Condition))

AddLocalScopeForJournal assign a local scope to a model

func AddLocalScopeForShare

func AddLocalScopeForShare(name string, apply func(builder query.Condition))

AddLocalScopeForShare assign a local scope to a model

func AddLocalScopeForSharePlan

func AddLocalScopeForSharePlan(name string, apply func(builder query.Condition))

AddLocalScopeForSharePlan assign a local scope to a model

func AddLocalScopeForShareUserRel

func AddLocalScopeForShareUserRel(name string, apply func(builder query.Condition))

AddLocalScopeForShareUserRel assign a local scope to a model

func AddLocalScopeForUser

func AddLocalScopeForUser(name string, apply func(builder query.Condition))

AddLocalScopeForUser assign a local scope to a model

func AttachmentFields

func AttachmentFields() []string

AttachmentFields return all fields in Attachment model

func JournalFields

func JournalFields() []string

JournalFields return all fields in Journal model

func SetAttachmentTable

func SetAttachmentTable(tableName string)

func SetJournalTable

func SetJournalTable(tableName string)

func SetSharePlanTable

func SetSharePlanTable(tableName string)

func SetShareTable

func SetShareTable(tableName string)

func SetShareUserRelTable

func SetShareUserRelTable(tableName string)

func SetUserTable

func SetUserTable(tableName string)

func ShareFields

func ShareFields() []string

ShareFields return all fields in Share model

func SharePlanFields

func SharePlanFields() []string

SharePlanFields return all fields in SharePlan model

func ShareUserRelFields

func ShareUserRelFields() []string

ShareUserRelFields return all fields in ShareUserRel model

func UserFields

func UserFields() []string

UserFields return all fields in User model

Types

type Attachment

type Attachment struct {
	Id        null.Int
	Name      null.String
	AttaType  null.String
	AttaPath  null.String
	CreatedAt null.Time
	// contains filtered or unexported fields
}

Attachment is a Attachment object

func (*Attachment) As

func (inst *Attachment) As(dst interface{}) error

As convert object to other type dst must be a pointer to struct

func (*Attachment) Delete

func (inst *Attachment) Delete() error

Delete remove a attachment

func (*Attachment) Save

func (inst *Attachment) Save(onlyFields ...string) error

Save create a new model or update it

func (*Attachment) SetModel

func (inst *Attachment) SetModel(attachmentModel *AttachmentModel)

SetModel set model for Attachment

func (*Attachment) Staled

func (inst *Attachment) Staled(onlyFields ...string) bool

Staled identify whether the object has been modified

func (*Attachment) StaledKV

func (inst *Attachment) StaledKV(onlyFields ...string) query.KV

StaledKV return all fields has been modified

func (*Attachment) String

func (inst *Attachment) String() string

String convert instance to json string

func (*Attachment) ToAttachmentPlain

func (w *Attachment) ToAttachmentPlain() AttachmentPlain

type AttachmentModel

type AttachmentModel struct {
	// contains filtered or unexported fields
}

AttachmentModel is a model which encapsulates the operations of the object

func NewAttachmentModel

func NewAttachmentModel(db query.Database) *AttachmentModel

NewAttachmentModel create a AttachmentModel

func (*AttachmentModel) Condition

func (m *AttachmentModel) Condition(builder query.SQLBuilder) *AttachmentModel

Condition add query builder to model

func (*AttachmentModel) Count

func (m *AttachmentModel) Count(builders ...query.SQLBuilder) (int64, error)

Count return model count for a given query

func (*AttachmentModel) Create

func (m *AttachmentModel) Create(kv query.KV) (int64, error)

Create save a new attachment to database

func (*AttachmentModel) Delete

func (m *AttachmentModel) Delete(builders ...query.SQLBuilder) (int64, error)

Delete remove a model

func (*AttachmentModel) DeleteById

func (m *AttachmentModel) DeleteById(id int64) (int64, error)

DeleteById remove a model by id

func (*AttachmentModel) Exists

func (m *AttachmentModel) Exists(builders ...query.SQLBuilder) (bool, error)

Exists return whether the records exists for a given query

func (*AttachmentModel) Find

func (m *AttachmentModel) Find(id int64) (Attachment, error)

Find retrieve a model by its primary key

func (*AttachmentModel) First

func (m *AttachmentModel) First(builders ...query.SQLBuilder) (Attachment, error)

First return first result for given query

func (*AttachmentModel) Get

func (m *AttachmentModel) Get(builders ...query.SQLBuilder) ([]Attachment, error)

Get retrieve all results for given query

func (*AttachmentModel) GetDB

func (m *AttachmentModel) GetDB() query.Database

GetDB return database instance

func (*AttachmentModel) Paginate

func (m *AttachmentModel) Paginate(page int64, perPage int64, builders ...query.SQLBuilder) ([]Attachment, query.PaginateMeta, error)

func (*AttachmentModel) Save

func (m *AttachmentModel) Save(attachment Attachment, onlyFields ...string) (int64, error)

Save save a attachment to database

func (*AttachmentModel) SaveAll

func (m *AttachmentModel) SaveAll(attachments []Attachment) ([]int64, error)

SaveAll save all attachments to database

func (*AttachmentModel) SaveOrUpdate

func (m *AttachmentModel) SaveOrUpdate(attachment Attachment, onlyFields ...string) (id int64, updated bool, err error)

SaveOrUpdate save a new attachment or update it when it has a id > 0

func (*AttachmentModel) Update

func (m *AttachmentModel) Update(attachment Attachment, builders ...query.SQLBuilder) (int64, error)

Update update a model for given query

func (*AttachmentModel) UpdateById

func (m *AttachmentModel) UpdateById(id int64, attachment Attachment, onlyFields ...string) (int64, error)

UpdateById update a model by id

func (*AttachmentModel) UpdateFields

func (m *AttachmentModel) UpdateFields(kv query.KV, builders ...query.SQLBuilder) (int64, error)

UpdateFields update kv for a given query

func (*AttachmentModel) UpdatePart

func (m *AttachmentModel) UpdatePart(attachment Attachment, onlyFields ...string) (int64, error)

UpdatePart update a model for given query

func (*AttachmentModel) WithLocalScopes

func (m *AttachmentModel) WithLocalScopes(names ...string) *AttachmentModel

WithLocalScopes add a local scope for given query

func (*AttachmentModel) WithoutGlobalScopes

func (m *AttachmentModel) WithoutGlobalScopes(names ...string) *AttachmentModel

WithoutGlobalScopes remove a global scope for given query

type AttachmentPlain

type AttachmentPlain struct {
	Id        int64
	Name      string
	AttaType  string
	AttaPath  string
	CreatedAt time.Time
}

func (AttachmentPlain) As

func (w AttachmentPlain) As(dst interface{}) error

As convert object to other type dst must be a pointer to struct

func (AttachmentPlain) ToAttachment

func (w AttachmentPlain) ToAttachment(allows ...string) Attachment

type Journal

type Journal struct {
	Id            null.Int
	Action        null.String
	Params        null.String
	TriggerUserId null.Int
	CreatedAt     null.Time
	// contains filtered or unexported fields
}

Journal is a Journal object

func (*Journal) As

func (inst *Journal) As(dst interface{}) error

As convert object to other type dst must be a pointer to struct

func (*Journal) Delete

func (inst *Journal) Delete() error

Delete remove a journal

func (*Journal) Save

func (inst *Journal) Save(onlyFields ...string) error

Save create a new model or update it

func (*Journal) SetModel

func (inst *Journal) SetModel(journalModel *JournalModel)

SetModel set model for Journal

func (*Journal) Staled

func (inst *Journal) Staled(onlyFields ...string) bool

Staled identify whether the object has been modified

func (*Journal) StaledKV

func (inst *Journal) StaledKV(onlyFields ...string) query.KV

StaledKV return all fields has been modified

func (*Journal) String

func (inst *Journal) String() string

String convert instance to json string

func (*Journal) ToJournalPlain

func (w *Journal) ToJournalPlain() JournalPlain

type JournalModel

type JournalModel struct {
	// contains filtered or unexported fields
}

JournalModel is a model which encapsulates the operations of the object

func NewJournalModel

func NewJournalModel(db query.Database) *JournalModel

NewJournalModel create a JournalModel

func (*JournalModel) Condition

func (m *JournalModel) Condition(builder query.SQLBuilder) *JournalModel

Condition add query builder to model

func (*JournalModel) Count

func (m *JournalModel) Count(builders ...query.SQLBuilder) (int64, error)

Count return model count for a given query

func (*JournalModel) Create

func (m *JournalModel) Create(kv query.KV) (int64, error)

Create save a new journal to database

func (*JournalModel) Delete

func (m *JournalModel) Delete(builders ...query.SQLBuilder) (int64, error)

Delete remove a model

func (*JournalModel) DeleteById

func (m *JournalModel) DeleteById(id int64) (int64, error)

DeleteById remove a model by id

func (*JournalModel) Exists

func (m *JournalModel) Exists(builders ...query.SQLBuilder) (bool, error)

Exists return whether the records exists for a given query

func (*JournalModel) Find

func (m *JournalModel) Find(id int64) (Journal, error)

Find retrieve a model by its primary key

func (*JournalModel) First

func (m *JournalModel) First(builders ...query.SQLBuilder) (Journal, error)

First return first result for given query

func (*JournalModel) Get

func (m *JournalModel) Get(builders ...query.SQLBuilder) ([]Journal, error)

Get retrieve all results for given query

func (*JournalModel) GetDB

func (m *JournalModel) GetDB() query.Database

GetDB return database instance

func (*JournalModel) Paginate

func (m *JournalModel) Paginate(page int64, perPage int64, builders ...query.SQLBuilder) ([]Journal, query.PaginateMeta, error)

func (*JournalModel) Save

func (m *JournalModel) Save(journal Journal, onlyFields ...string) (int64, error)

Save save a journal to database

func (*JournalModel) SaveAll

func (m *JournalModel) SaveAll(journals []Journal) ([]int64, error)

SaveAll save all journals to database

func (*JournalModel) SaveOrUpdate

func (m *JournalModel) SaveOrUpdate(journal Journal, onlyFields ...string) (id int64, updated bool, err error)

SaveOrUpdate save a new journal or update it when it has a id > 0

func (*JournalModel) Update

func (m *JournalModel) Update(journal Journal, builders ...query.SQLBuilder) (int64, error)

Update update a model for given query

func (*JournalModel) UpdateById

func (m *JournalModel) UpdateById(id int64, journal Journal, onlyFields ...string) (int64, error)

UpdateById update a model by id

func (*JournalModel) UpdateFields

func (m *JournalModel) UpdateFields(kv query.KV, builders ...query.SQLBuilder) (int64, error)

UpdateFields update kv for a given query

func (*JournalModel) UpdatePart

func (m *JournalModel) UpdatePart(journal Journal, onlyFields ...string) (int64, error)

UpdatePart update a model for given query

func (*JournalModel) WithLocalScopes

func (m *JournalModel) WithLocalScopes(names ...string) *JournalModel

WithLocalScopes add a local scope for given query

func (*JournalModel) WithoutGlobalScopes

func (m *JournalModel) WithoutGlobalScopes(names ...string) *JournalModel

WithoutGlobalScopes remove a global scope for given query

type JournalPlain

type JournalPlain struct {
	Id            int64
	Action        string
	Params        string
	TriggerUserId int64
	CreatedAt     time.Time
}

func (JournalPlain) As

func (w JournalPlain) As(dst interface{}) error

As convert object to other type dst must be a pointer to struct

func (JournalPlain) ToJournal

func (w JournalPlain) ToJournal(allows ...string) Journal

type Share

type Share struct {
	Id           null.Int
	Subject      null.String
	Description  null.String
	SubjectType  null.String
	Status       null.Int
	ShareUser    null.String
	ShareUserId  null.Int
	CreateUserId null.Int
	Note         null.String
	LikeCount    null.Int
	JoinCount    null.Int
	Attachments  null.String
	ShareAt      null.Time
	CreatedAt    null.Time
	UpdatedAt    null.Time
	DeletedAt    null.Time
	// contains filtered or unexported fields
}

Share is a Share object

func (*Share) As

func (inst *Share) As(dst interface{}) error

As convert object to other type dst must be a pointer to struct

func (*Share) Delete

func (inst *Share) Delete() error

Delete remove a share

func (*Share) Save

func (inst *Share) Save(onlyFields ...string) error

Save create a new model or update it

func (*Share) SetModel

func (inst *Share) SetModel(shareModel *ShareModel)

SetModel set model for Share

func (*Share) SharePlan

func (inst *Share) SharePlan() *ShareHasOneSharePlanRel

func (*Share) ShareUserRels

func (inst *Share) ShareUserRels() *ShareHasManyShareUserRelRel

func (*Share) Staled

func (inst *Share) Staled(onlyFields ...string) bool

Staled identify whether the object has been modified

func (*Share) StaledKV

func (inst *Share) StaledKV(onlyFields ...string) query.KV

StaledKV return all fields has been modified

func (*Share) String

func (inst *Share) String() string

String convert instance to json string

func (*Share) ToSharePlain

func (w *Share) ToSharePlain() SharePlain

type ShareHasManyShareUserRelRel

type ShareHasManyShareUserRelRel struct {
	// contains filtered or unexported fields
}

func (*ShareHasManyShareUserRelRel) Count

func (rel *ShareHasManyShareUserRelRel) Count(builders ...query.SQLBuilder) (int64, error)

func (*ShareHasManyShareUserRelRel) Create

func (rel *ShareHasManyShareUserRelRel) Create(target ShareUserRel) (int64, error)

func (*ShareHasManyShareUserRelRel) Exists

func (rel *ShareHasManyShareUserRelRel) Exists(builders ...query.SQLBuilder) (bool, error)

func (*ShareHasManyShareUserRelRel) First

func (rel *ShareHasManyShareUserRelRel) First(builders ...query.SQLBuilder) (ShareUserRel, error)

func (*ShareHasManyShareUserRelRel) Get

func (rel *ShareHasManyShareUserRelRel) Get(builders ...query.SQLBuilder) ([]ShareUserRel, error)

type ShareHasOneSharePlanRel

type ShareHasOneSharePlanRel struct {
	// contains filtered or unexported fields
}

func (*ShareHasOneSharePlanRel) Associate

func (rel *ShareHasOneSharePlanRel) Associate(target SharePlan) error

func (*ShareHasOneSharePlanRel) Create

func (rel *ShareHasOneSharePlanRel) Create(target SharePlan) (int64, error)

func (*ShareHasOneSharePlanRel) Dissociate

func (rel *ShareHasOneSharePlanRel) Dissociate() error

func (*ShareHasOneSharePlanRel) Exists

func (rel *ShareHasOneSharePlanRel) Exists(builders ...query.SQLBuilder) (bool, error)

func (*ShareHasOneSharePlanRel) First

func (rel *ShareHasOneSharePlanRel) First(builders ...query.SQLBuilder) (SharePlan, error)

type ShareModel

type ShareModel struct {
	// contains filtered or unexported fields
}

ShareModel is a model which encapsulates the operations of the object

func NewShareModel

func NewShareModel(db query.Database) *ShareModel

NewShareModel create a ShareModel

func (*ShareModel) Condition

func (m *ShareModel) Condition(builder query.SQLBuilder) *ShareModel

Condition add query builder to model

func (*ShareModel) Count

func (m *ShareModel) Count(builders ...query.SQLBuilder) (int64, error)

Count return model count for a given query

func (*ShareModel) Create

func (m *ShareModel) Create(kv query.KV) (int64, error)

Create save a new share to database

func (*ShareModel) Delete

func (m *ShareModel) Delete(builders ...query.SQLBuilder) (int64, error)

Delete remove a model

func (*ShareModel) DeleteById

func (m *ShareModel) DeleteById(id int64) (int64, error)

DeleteById remove a model by id

func (*ShareModel) Exists

func (m *ShareModel) Exists(builders ...query.SQLBuilder) (bool, error)

Exists return whether the records exists for a given query

func (*ShareModel) Find

func (m *ShareModel) Find(id int64) (Share, error)

Find retrieve a model by its primary key

func (*ShareModel) First

func (m *ShareModel) First(builders ...query.SQLBuilder) (Share, error)

First return first result for given query

func (*ShareModel) ForceDelete

func (m *ShareModel) ForceDelete(builders ...query.SQLBuilder) (int64, error)

ForceDelete permanently remove a soft deleted model from the database

func (*ShareModel) ForceDeleteById

func (m *ShareModel) ForceDeleteById(id int64) (int64, error)

ForceDeleteById permanently remove a soft deleted model from the database by id

func (*ShareModel) Get

func (m *ShareModel) Get(builders ...query.SQLBuilder) ([]Share, error)

Get retrieve all results for given query

func (*ShareModel) GetDB

func (m *ShareModel) GetDB() query.Database

GetDB return database instance

func (*ShareModel) Paginate

func (m *ShareModel) Paginate(page int64, perPage int64, builders ...query.SQLBuilder) ([]Share, query.PaginateMeta, error)

func (*ShareModel) Restore

func (m *ShareModel) Restore(builders ...query.SQLBuilder) (int64, error)

Restore restore a soft deleted model into an active state

func (*ShareModel) RestoreById

func (m *ShareModel) RestoreById(id int64) (int64, error)

RestoreById restore a soft deleted model into an active state by id

func (*ShareModel) Save

func (m *ShareModel) Save(share Share, onlyFields ...string) (int64, error)

Save save a share to database

func (*ShareModel) SaveAll

func (m *ShareModel) SaveAll(shares []Share) ([]int64, error)

SaveAll save all shares to database

func (*ShareModel) SaveOrUpdate

func (m *ShareModel) SaveOrUpdate(share Share, onlyFields ...string) (id int64, updated bool, err error)

SaveOrUpdate save a new share or update it when it has a id > 0

func (*ShareModel) Update

func (m *ShareModel) Update(share Share, builders ...query.SQLBuilder) (int64, error)

Update update a model for given query

func (*ShareModel) UpdateById

func (m *ShareModel) UpdateById(id int64, share Share, onlyFields ...string) (int64, error)

UpdateById update a model by id

func (*ShareModel) UpdateFields

func (m *ShareModel) UpdateFields(kv query.KV, builders ...query.SQLBuilder) (int64, error)

UpdateFields update kv for a given query

func (*ShareModel) UpdatePart

func (m *ShareModel) UpdatePart(share Share, onlyFields ...string) (int64, error)

UpdatePart update a model for given query

func (*ShareModel) WithLocalScopes

func (m *ShareModel) WithLocalScopes(names ...string) *ShareModel

WithLocalScopes add a local scope for given query

func (*ShareModel) WithTrashed

func (m *ShareModel) WithTrashed() *ShareModel

WithTrashed force soft deleted models to appear in a result set

func (*ShareModel) WithoutGlobalScopes

func (m *ShareModel) WithoutGlobalScopes(names ...string) *ShareModel

WithoutGlobalScopes remove a global scope for given query

type SharePlain

type SharePlain struct {
	Id           int64
	Subject      string
	Description  string
	SubjectType  string
	Status       int8
	ShareUser    string
	ShareUserId  int64
	CreateUserId int64
	Note         string
	LikeCount    int64
	JoinCount    int64
	Attachments  string
	ShareAt      time.Time
	CreatedAt    time.Time
	UpdatedAt    time.Time
	DeletedAt    time.Time
}

func (SharePlain) As

func (w SharePlain) As(dst interface{}) error

As convert object to other type dst must be a pointer to struct

func (SharePlain) ToShare

func (w SharePlain) ToShare(allows ...string) Share

type SharePlan

type SharePlan struct {
	Id           null.Int
	ShareId      null.Int
	ShareAt      null.Time
	ShareRoom    null.String
	PlanDuration null.Int
	RealDuration null.Int
	Note         null.String
	CreatedAt    null.Time
	UpdatedAt    null.Time
	// contains filtered or unexported fields
}

SharePlan is a SharePlan object

func (*SharePlan) As

func (inst *SharePlan) As(dst interface{}) error

As convert object to other type dst must be a pointer to struct

func (*SharePlan) Delete

func (inst *SharePlan) Delete() error

Delete remove a share_plan

func (*SharePlan) Save

func (inst *SharePlan) Save(onlyFields ...string) error

Save create a new model or update it

func (*SharePlan) SetModel

func (inst *SharePlan) SetModel(sharePlanModel *SharePlanModel)

SetModel set model for SharePlan

func (*SharePlan) Share

func (inst *SharePlan) Share() *SharePlanBelongsToShareRel

func (*SharePlan) Staled

func (inst *SharePlan) Staled(onlyFields ...string) bool

Staled identify whether the object has been modified

func (*SharePlan) StaledKV

func (inst *SharePlan) StaledKV(onlyFields ...string) query.KV

StaledKV return all fields has been modified

func (*SharePlan) String

func (inst *SharePlan) String() string

String convert instance to json string

func (*SharePlan) ToSharePlanPlain

func (w *SharePlan) ToSharePlanPlain() SharePlanPlain

type SharePlanBelongsToShareRel

type SharePlanBelongsToShareRel struct {
	// contains filtered or unexported fields
}

func (*SharePlanBelongsToShareRel) Associate

func (rel *SharePlanBelongsToShareRel) Associate(target Share) error

func (*SharePlanBelongsToShareRel) Create

func (rel *SharePlanBelongsToShareRel) Create(target Share) (int64, error)

func (*SharePlanBelongsToShareRel) Dissociate

func (rel *SharePlanBelongsToShareRel) Dissociate() error

func (*SharePlanBelongsToShareRel) Exists

func (rel *SharePlanBelongsToShareRel) Exists(builders ...query.SQLBuilder) (bool, error)

func (*SharePlanBelongsToShareRel) First

func (rel *SharePlanBelongsToShareRel) First(builders ...query.SQLBuilder) (Share, error)

type SharePlanModel

type SharePlanModel struct {
	// contains filtered or unexported fields
}

SharePlanModel is a model which encapsulates the operations of the object

func NewSharePlanModel

func NewSharePlanModel(db query.Database) *SharePlanModel

NewSharePlanModel create a SharePlanModel

func (*SharePlanModel) Condition

func (m *SharePlanModel) Condition(builder query.SQLBuilder) *SharePlanModel

Condition add query builder to model

func (*SharePlanModel) Count

func (m *SharePlanModel) Count(builders ...query.SQLBuilder) (int64, error)

Count return model count for a given query

func (*SharePlanModel) Create

func (m *SharePlanModel) Create(kv query.KV) (int64, error)

Create save a new share_plan to database

func (*SharePlanModel) Delete

func (m *SharePlanModel) Delete(builders ...query.SQLBuilder) (int64, error)

Delete remove a model

func (*SharePlanModel) DeleteById

func (m *SharePlanModel) DeleteById(id int64) (int64, error)

DeleteById remove a model by id

func (*SharePlanModel) Exists

func (m *SharePlanModel) Exists(builders ...query.SQLBuilder) (bool, error)

Exists return whether the records exists for a given query

func (*SharePlanModel) Find

func (m *SharePlanModel) Find(id int64) (SharePlan, error)

Find retrieve a model by its primary key

func (*SharePlanModel) First

func (m *SharePlanModel) First(builders ...query.SQLBuilder) (SharePlan, error)

First return first result for given query

func (*SharePlanModel) Get

func (m *SharePlanModel) Get(builders ...query.SQLBuilder) ([]SharePlan, error)

Get retrieve all results for given query

func (*SharePlanModel) GetDB

func (m *SharePlanModel) GetDB() query.Database

GetDB return database instance

func (*SharePlanModel) Paginate

func (m *SharePlanModel) Paginate(page int64, perPage int64, builders ...query.SQLBuilder) ([]SharePlan, query.PaginateMeta, error)

func (*SharePlanModel) Save

func (m *SharePlanModel) Save(sharePlan SharePlan, onlyFields ...string) (int64, error)

Save save a share_plan to database

func (*SharePlanModel) SaveAll

func (m *SharePlanModel) SaveAll(sharePlans []SharePlan) ([]int64, error)

SaveAll save all share_plans to database

func (*SharePlanModel) SaveOrUpdate

func (m *SharePlanModel) SaveOrUpdate(sharePlan SharePlan, onlyFields ...string) (id int64, updated bool, err error)

SaveOrUpdate save a new share_plan or update it when it has a id > 0

func (*SharePlanModel) Update

func (m *SharePlanModel) Update(sharePlan SharePlan, builders ...query.SQLBuilder) (int64, error)

Update update a model for given query

func (*SharePlanModel) UpdateById

func (m *SharePlanModel) UpdateById(id int64, sharePlan SharePlan, onlyFields ...string) (int64, error)

UpdateById update a model by id

func (*SharePlanModel) UpdateFields

func (m *SharePlanModel) UpdateFields(kv query.KV, builders ...query.SQLBuilder) (int64, error)

UpdateFields update kv for a given query

func (*SharePlanModel) UpdatePart

func (m *SharePlanModel) UpdatePart(sharePlan SharePlan, onlyFields ...string) (int64, error)

UpdatePart update a model for given query

func (*SharePlanModel) WithLocalScopes

func (m *SharePlanModel) WithLocalScopes(names ...string) *SharePlanModel

WithLocalScopes add a local scope for given query

func (*SharePlanModel) WithoutGlobalScopes

func (m *SharePlanModel) WithoutGlobalScopes(names ...string) *SharePlanModel

WithoutGlobalScopes remove a global scope for given query

type SharePlanPlain

type SharePlanPlain struct {
	Id           int64
	ShareId      int64
	ShareAt      time.Time
	ShareRoom    string
	PlanDuration int
	RealDuration int
	Note         string
	CreatedAt    time.Time
	UpdatedAt    time.Time
}

func (SharePlanPlain) As

func (w SharePlanPlain) As(dst interface{}) error

As convert object to other type dst must be a pointer to struct

func (SharePlanPlain) ToSharePlan

func (w SharePlanPlain) ToSharePlan(allows ...string) SharePlan

type ShareUserRel

type ShareUserRel struct {
	Id        null.Int
	ShareId   null.Int
	UserId    null.Int
	RelType   null.Int
	CreatedAt null.Time
	// contains filtered or unexported fields
}

ShareUserRel is a ShareUserRel object

func (*ShareUserRel) As

func (inst *ShareUserRel) As(dst interface{}) error

As convert object to other type dst must be a pointer to struct

func (*ShareUserRel) Delete

func (inst *ShareUserRel) Delete() error

Delete remove a share_user_rel

func (*ShareUserRel) Save

func (inst *ShareUserRel) Save(onlyFields ...string) error

Save create a new model or update it

func (*ShareUserRel) SetModel

func (inst *ShareUserRel) SetModel(shareUserRelModel *ShareUserRelModel)

SetModel set model for ShareUserRel

func (*ShareUserRel) Staled

func (inst *ShareUserRel) Staled(onlyFields ...string) bool

Staled identify whether the object has been modified

func (*ShareUserRel) StaledKV

func (inst *ShareUserRel) StaledKV(onlyFields ...string) query.KV

StaledKV return all fields has been modified

func (*ShareUserRel) String

func (inst *ShareUserRel) String() string

String convert instance to json string

func (*ShareUserRel) ToShareUserRelPlain

func (w *ShareUserRel) ToShareUserRelPlain() ShareUserRelPlain

func (*ShareUserRel) User

type ShareUserRelBelongsToUserRel

type ShareUserRelBelongsToUserRel struct {
	// contains filtered or unexported fields
}

func (*ShareUserRelBelongsToUserRel) Associate

func (rel *ShareUserRelBelongsToUserRel) Associate(target User) error

func (*ShareUserRelBelongsToUserRel) Create

func (rel *ShareUserRelBelongsToUserRel) Create(target User) (int64, error)

func (*ShareUserRelBelongsToUserRel) Dissociate

func (rel *ShareUserRelBelongsToUserRel) Dissociate() error

func (*ShareUserRelBelongsToUserRel) Exists

func (rel *ShareUserRelBelongsToUserRel) Exists(builders ...query.SQLBuilder) (bool, error)

func (*ShareUserRelBelongsToUserRel) First

func (rel *ShareUserRelBelongsToUserRel) First(builders ...query.SQLBuilder) (User, error)

type ShareUserRelModel

type ShareUserRelModel struct {
	// contains filtered or unexported fields
}

ShareUserRelModel is a model which encapsulates the operations of the object

func NewShareUserRelModel

func NewShareUserRelModel(db query.Database) *ShareUserRelModel

NewShareUserRelModel create a ShareUserRelModel

func (*ShareUserRelModel) Condition

func (m *ShareUserRelModel) Condition(builder query.SQLBuilder) *ShareUserRelModel

Condition add query builder to model

func (*ShareUserRelModel) Count

func (m *ShareUserRelModel) Count(builders ...query.SQLBuilder) (int64, error)

Count return model count for a given query

func (*ShareUserRelModel) Create

func (m *ShareUserRelModel) Create(kv query.KV) (int64, error)

Create save a new share_user_rel to database

func (*ShareUserRelModel) Delete

func (m *ShareUserRelModel) Delete(builders ...query.SQLBuilder) (int64, error)

Delete remove a model

func (*ShareUserRelModel) DeleteById

func (m *ShareUserRelModel) DeleteById(id int64) (int64, error)

DeleteById remove a model by id

func (*ShareUserRelModel) Exists

func (m *ShareUserRelModel) Exists(builders ...query.SQLBuilder) (bool, error)

Exists return whether the records exists for a given query

func (*ShareUserRelModel) Find

func (m *ShareUserRelModel) Find(id int64) (ShareUserRel, error)

Find retrieve a model by its primary key

func (*ShareUserRelModel) First

func (m *ShareUserRelModel) First(builders ...query.SQLBuilder) (ShareUserRel, error)

First return first result for given query

func (*ShareUserRelModel) Get

func (m *ShareUserRelModel) Get(builders ...query.SQLBuilder) ([]ShareUserRel, error)

Get retrieve all results for given query

func (*ShareUserRelModel) GetDB

func (m *ShareUserRelModel) GetDB() query.Database

GetDB return database instance

func (*ShareUserRelModel) Paginate

func (m *ShareUserRelModel) Paginate(page int64, perPage int64, builders ...query.SQLBuilder) ([]ShareUserRel, query.PaginateMeta, error)

func (*ShareUserRelModel) Save

func (m *ShareUserRelModel) Save(shareUserRel ShareUserRel, onlyFields ...string) (int64, error)

Save save a share_user_rel to database

func (*ShareUserRelModel) SaveAll

func (m *ShareUserRelModel) SaveAll(shareUserRels []ShareUserRel) ([]int64, error)

SaveAll save all share_user_rels to database

func (*ShareUserRelModel) SaveOrUpdate

func (m *ShareUserRelModel) SaveOrUpdate(shareUserRel ShareUserRel, onlyFields ...string) (id int64, updated bool, err error)

SaveOrUpdate save a new share_user_rel or update it when it has a id > 0

func (*ShareUserRelModel) Update

func (m *ShareUserRelModel) Update(shareUserRel ShareUserRel, builders ...query.SQLBuilder) (int64, error)

Update update a model for given query

func (*ShareUserRelModel) UpdateById

func (m *ShareUserRelModel) UpdateById(id int64, shareUserRel ShareUserRel, onlyFields ...string) (int64, error)

UpdateById update a model by id

func (*ShareUserRelModel) UpdateFields

func (m *ShareUserRelModel) UpdateFields(kv query.KV, builders ...query.SQLBuilder) (int64, error)

UpdateFields update kv for a given query

func (*ShareUserRelModel) UpdatePart

func (m *ShareUserRelModel) UpdatePart(shareUserRel ShareUserRel, onlyFields ...string) (int64, error)

UpdatePart update a model for given query

func (*ShareUserRelModel) WithLocalScopes

func (m *ShareUserRelModel) WithLocalScopes(names ...string) *ShareUserRelModel

WithLocalScopes add a local scope for given query

func (*ShareUserRelModel) WithoutGlobalScopes

func (m *ShareUserRelModel) WithoutGlobalScopes(names ...string) *ShareUserRelModel

WithoutGlobalScopes remove a global scope for given query

type ShareUserRelPlain

type ShareUserRelPlain struct {
	Id        int64
	ShareId   int64
	UserId    int64
	RelType   int8
	CreatedAt time.Time
}

func (ShareUserRelPlain) As

func (w ShareUserRelPlain) As(dst interface{}) error

As convert object to other type dst must be a pointer to struct

func (ShareUserRelPlain) ToShareUserRel

func (w ShareUserRelPlain) ToShareUserRel(allows ...string) ShareUserRel

type User

type User struct {
	Id        null.Int
	Uuid      null.String
	Name      null.String
	Account   null.String
	Status    null.Int
	Password  null.String `json:"-"`
	CreatedAt null.Time
	UpdatedAt null.Time
	// contains filtered or unexported fields
}

User is a User object

func (*User) As

func (inst *User) As(dst interface{}) error

As convert object to other type dst must be a pointer to struct

func (*User) Delete

func (inst *User) Delete() error

Delete remove a user

func (*User) Save

func (inst *User) Save(onlyFields ...string) error

Save create a new model or update it

func (*User) SetModel

func (inst *User) SetModel(userModel *UserModel)

SetModel set model for User

func (*User) Staled

func (inst *User) Staled(onlyFields ...string) bool

Staled identify whether the object has been modified

func (*User) StaledKV

func (inst *User) StaledKV(onlyFields ...string) query.KV

StaledKV return all fields has been modified

func (*User) String

func (inst *User) String() string

String convert instance to json string

func (*User) ToUserPlain

func (w *User) ToUserPlain() UserPlain

type UserModel

type UserModel struct {
	// contains filtered or unexported fields
}

UserModel is a model which encapsulates the operations of the object

func NewUserModel

func NewUserModel(db query.Database) *UserModel

NewUserModel create a UserModel

func (*UserModel) Condition

func (m *UserModel) Condition(builder query.SQLBuilder) *UserModel

Condition add query builder to model

func (*UserModel) Count

func (m *UserModel) Count(builders ...query.SQLBuilder) (int64, error)

Count return model count for a given query

func (*UserModel) Create

func (m *UserModel) Create(kv query.KV) (int64, error)

Create save a new user to database

func (*UserModel) Delete

func (m *UserModel) Delete(builders ...query.SQLBuilder) (int64, error)

Delete remove a model

func (*UserModel) DeleteById

func (m *UserModel) DeleteById(id int64) (int64, error)

DeleteById remove a model by id

func (*UserModel) Exists

func (m *UserModel) Exists(builders ...query.SQLBuilder) (bool, error)

Exists return whether the records exists for a given query

func (*UserModel) Find

func (m *UserModel) Find(id int64) (User, error)

Find retrieve a model by its primary key

func (*UserModel) First

func (m *UserModel) First(builders ...query.SQLBuilder) (User, error)

First return first result for given query

func (*UserModel) Get

func (m *UserModel) Get(builders ...query.SQLBuilder) ([]User, error)

Get retrieve all results for given query

func (*UserModel) GetDB

func (m *UserModel) GetDB() query.Database

GetDB return database instance

func (*UserModel) Paginate

func (m *UserModel) Paginate(page int64, perPage int64, builders ...query.SQLBuilder) ([]User, query.PaginateMeta, error)

func (*UserModel) Save

func (m *UserModel) Save(user User, onlyFields ...string) (int64, error)

Save save a user to database

func (*UserModel) SaveAll

func (m *UserModel) SaveAll(users []User) ([]int64, error)

SaveAll save all users to database

func (*UserModel) SaveOrUpdate

func (m *UserModel) SaveOrUpdate(user User, onlyFields ...string) (id int64, updated bool, err error)

SaveOrUpdate save a new user or update it when it has a id > 0

func (*UserModel) Update

func (m *UserModel) Update(user User, builders ...query.SQLBuilder) (int64, error)

Update update a model for given query

func (*UserModel) UpdateById

func (m *UserModel) UpdateById(id int64, user User, onlyFields ...string) (int64, error)

UpdateById update a model by id

func (*UserModel) UpdateFields

func (m *UserModel) UpdateFields(kv query.KV, builders ...query.SQLBuilder) (int64, error)

UpdateFields update kv for a given query

func (*UserModel) UpdatePart

func (m *UserModel) UpdatePart(user User, onlyFields ...string) (int64, error)

UpdatePart update a model for given query

func (*UserModel) WithLocalScopes

func (m *UserModel) WithLocalScopes(names ...string) *UserModel

WithLocalScopes add a local scope for given query

func (*UserModel) WithoutGlobalScopes

func (m *UserModel) WithoutGlobalScopes(names ...string) *UserModel

WithoutGlobalScopes remove a global scope for given query

type UserPlain

type UserPlain struct {
	Id        int64
	Uuid      string
	Name      string
	Account   string
	Status    int8
	Password  string
	CreatedAt time.Time
	UpdatedAt time.Time
}

func (UserPlain) As

func (w UserPlain) As(dst interface{}) error

As convert object to other type dst must be a pointer to struct

func (UserPlain) ToUser

func (w UserPlain) ToUser(allows ...string) User

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL