models

package
v0.0.0-...-0c6052a Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FieldEnterpriseId        = "id"
	FieldEnterpriseName      = "name"
	FieldEnterpriseAddress   = "address"
	FieldEnterpriseStatus    = "status"
	FieldEnterpriseCreatedAt = "created_at"
	FieldEnterpriseUpdatedAt = "updated_at"
	FieldEnterpriseDeletedAt = "deleted_at"
)
View Source
const (
	FieldOrganizationId        = "id"
	FieldOrganizationName      = "name"
	FieldOrganizationCreatedAt = "created_at"
	FieldOrganizationUpdatedAt = "updated_at"
)
View Source
const (
	FieldRoleName        = "name"
	FieldRoleDescription = "description"
	FieldRoleId          = "id"
	FieldRoleCreatedAt   = "created_at"
	FieldRoleUpdatedAt   = "updated_at"
)
View Source
const (
	FieldUserId            = "id"
	FieldUserName          = "name"
	FieldUserEmail         = "email"
	FieldUserPassword      = "password"
	FieldUserRoleId        = "role_id"
	FieldUserEnterpriseId  = "enterprise_id"
	FieldUserRememberToken = "remember_token"
	FieldUserCreatedAt     = "created_at"
	FieldUserUpdatedAt     = "updated_at"
	FieldUserDeletedAt     = "deleted_at"
)
View Source
const (
	FieldUserExtAddress   = "address"
	FieldUserExtQq        = "qq"
	FieldUserExtWechat    = "wechat"
	FieldUserExtUserId    = "user_id"
	FieldUserExtId        = "id"
	FieldUserExtCreatedAt = "created_at"
	FieldUserExtUpdatedAt = "updated_at"
)
View Source
const (
	FieldPasswordResetEmail     = "email"
	FieldPasswordResetToken     = "token"
	FieldPasswordResetId        = "id"
	FieldPasswordResetCreatedAt = "created_at"
)

Variables

This section is empty.

Functions

func AddGlobalScopeForEnterprise

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

AddGlobalScopeForEnterprise assign a global scope to a model

func AddGlobalScopeForOrganization

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

AddGlobalScopeForOrganization assign a global scope to a model

func AddGlobalScopeForPasswordReset

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

AddGlobalScopeForPasswordReset assign a global scope to a model

func AddGlobalScopeForRole

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

AddGlobalScopeForRole 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 AddGlobalScopeForUserExt

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

AddGlobalScopeForUserExt assign a global scope to a model

func AddLocalScopeForEnterprise

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

AddLocalScopeForEnterprise assign a local scope to a model

func AddLocalScopeForOrganization

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

AddLocalScopeForOrganization assign a local scope to a model

func AddLocalScopeForPasswordReset

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

AddLocalScopeForPasswordReset assign a local scope to a model

func AddLocalScopeForRole

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

AddLocalScopeForRole 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 AddLocalScopeForUserExt

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

AddLocalScopeForUserExt assign a local scope to a model

func EnterpriseFields

func EnterpriseFields() []string

EnterpriseFields return all fields in Enterprise model

func EnterpriseTable

func EnterpriseTable() string

EnterpriseTable return table name for Enterprise

func OrganizationFields

func OrganizationFields() []string

OrganizationFields return all fields in Organization model

func OrganizationTable

func OrganizationTable() string

OrganizationTable return table name for Organization

func PasswordResetFields

func PasswordResetFields() []string

PasswordResetFields return all fields in PasswordReset model

func PasswordResetTable

func PasswordResetTable() string

PasswordResetTable return table name for PasswordReset

func RoleFields

func RoleFields() []string

RoleFields return all fields in Role model

func RoleTable

func RoleTable() string

RoleTable return table name for Role

func SetEnterpriseTable

func SetEnterpriseTable(tableName string)

func SetOrganizationTable

func SetOrganizationTable(tableName string)

func SetPasswordResetTable

func SetPasswordResetTable(tableName string)

func SetRoleTable

func SetRoleTable(tableName string)

func SetUserExtTable

func SetUserExtTable(tableName string)

func SetUserTable

func SetUserTable(tableName string)

func UserExtFields

func UserExtFields() []string

UserExtFields return all fields in UserExt model

func UserExtTable

func UserExtTable() string

UserExtTable return table name for UserExt

func UserFields

func UserFields() []string

UserFields return all fields in User model

func UserTable

func UserTable() string

UserTable return table name for User

Types

type Enterprise

type Enterprise struct {
	Id        int64
	Name      string
	Address   string
	Status    int8
	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt time.Time
}

func (Enterprise) As

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

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

func (Enterprise) ToEnterpriseN

func (w Enterprise) ToEnterpriseN(allows ...string) EnterpriseN

type EnterpriseHasManyUserRel

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

func (*EnterpriseHasManyUserRel) Count

func (rel *EnterpriseHasManyUserRel) Count(ctx context.Context, builders ...query.SQLBuilder) (int64, error)

func (*EnterpriseHasManyUserRel) Create

func (rel *EnterpriseHasManyUserRel) Create(ctx context.Context, target UserN) (int64, error)

func (*EnterpriseHasManyUserRel) Exists

func (rel *EnterpriseHasManyUserRel) Exists(ctx context.Context, builders ...query.SQLBuilder) (bool, error)

func (*EnterpriseHasManyUserRel) First

func (rel *EnterpriseHasManyUserRel) First(ctx context.Context, builders ...query.SQLBuilder) (*UserN, error)

func (*EnterpriseHasManyUserRel) Get

func (rel *EnterpriseHasManyUserRel) Get(ctx context.Context, builders ...query.SQLBuilder) ([]UserN, error)

type EnterpriseModel

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

EnterpriseModel is a model which encapsulates the operations of the object

func NewEnterpriseModel

func NewEnterpriseModel(db query.Database) *EnterpriseModel

NewEnterpriseModel create a EnterpriseModel

func (*EnterpriseModel) Condition

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

Condition add query builder to model

func (*EnterpriseModel) Count

func (m *EnterpriseModel) Count(ctx context.Context, builders ...query.SQLBuilder) (int64, error)

Count return model count for a given query

func (*EnterpriseModel) Create

func (m *EnterpriseModel) Create(ctx context.Context, kv query.KV) (int64, error)

Create save a new enterprise to database

func (*EnterpriseModel) Delete

func (m *EnterpriseModel) Delete(ctx context.Context, builders ...query.SQLBuilder) (int64, error)

Delete remove a model

func (*EnterpriseModel) DeleteById

func (m *EnterpriseModel) DeleteById(ctx context.Context, id int64) (int64, error)

DeleteById remove a model by id

func (*EnterpriseModel) Exists

func (m *EnterpriseModel) Exists(ctx context.Context, builders ...query.SQLBuilder) (bool, error)

Exists return whether the records exists for a given query

func (*EnterpriseModel) Find

func (m *EnterpriseModel) Find(ctx context.Context, id int64) (*EnterpriseN, error)

Find retrieve a model by its primary key

func (*EnterpriseModel) First

func (m *EnterpriseModel) First(ctx context.Context, builders ...query.SQLBuilder) (*EnterpriseN, error)

First return first result for given query

func (*EnterpriseModel) ForceDelete

func (m *EnterpriseModel) ForceDelete(ctx context.Context, builders ...query.SQLBuilder) (int64, error)

ForceDelete permanently remove a soft deleted model from the database

func (*EnterpriseModel) ForceDeleteById

func (m *EnterpriseModel) ForceDeleteById(ctx context.Context, id int64) (int64, error)

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

func (*EnterpriseModel) Get

func (m *EnterpriseModel) Get(ctx context.Context, builders ...query.SQLBuilder) ([]EnterpriseN, error)

Get retrieve all results for given query

func (*EnterpriseModel) GetDB

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

GetDB return database instance

func (*EnterpriseModel) Paginate

func (m *EnterpriseModel) Paginate(ctx context.Context, page int64, perPage int64, builders ...query.SQLBuilder) ([]EnterpriseN, query.PaginateMeta, error)

func (*EnterpriseModel) Restore

func (m *EnterpriseModel) Restore(ctx context.Context, builders ...query.SQLBuilder) (int64, error)

Restore restore a soft deleted model into an active state

func (*EnterpriseModel) RestoreById

func (m *EnterpriseModel) RestoreById(ctx context.Context, id int64) (int64, error)

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

func (*EnterpriseModel) Save

func (m *EnterpriseModel) Save(ctx context.Context, enterprise EnterpriseN, onlyFields ...string) (int64, error)

Save save a enterprise to database

func (*EnterpriseModel) SaveAll

func (m *EnterpriseModel) SaveAll(ctx context.Context, enterprises []EnterpriseN) ([]int64, error)

SaveAll save all enterprises to database

func (*EnterpriseModel) SaveOrUpdate

func (m *EnterpriseModel) SaveOrUpdate(ctx context.Context, enterprise EnterpriseN, onlyFields ...string) (id int64, updated bool, err error)

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

func (*EnterpriseModel) Update

func (m *EnterpriseModel) Update(ctx context.Context, builder query.SQLBuilder, enterprise EnterpriseN, onlyFields ...string) (int64, error)

Update update a model for given query

func (*EnterpriseModel) UpdateById

func (m *EnterpriseModel) UpdateById(ctx context.Context, id int64, enterprise EnterpriseN, onlyFields ...string) (int64, error)

UpdateById update a model by id

func (*EnterpriseModel) UpdateFields

func (m *EnterpriseModel) UpdateFields(ctx context.Context, kv query.KV, builders ...query.SQLBuilder) (int64, error)

UpdateFields update kv for a given query

func (*EnterpriseModel) WithLocalScopes

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

WithLocalScopes add a local scope for given query

func (*EnterpriseModel) WithTrashed

func (m *EnterpriseModel) WithTrashed() *EnterpriseModel

WithTrashed force soft deleted models to appear in a result set

func (*EnterpriseModel) WithoutGlobalScopes

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

WithoutGlobalScopes remove a global scope for given query

type EnterpriseN

type EnterpriseN struct {
	Id        null.Int
	Name      null.String
	Address   null.String
	Status    null.Int
	CreatedAt null.Time
	UpdatedAt null.Time
	DeletedAt null.Time
	// contains filtered or unexported fields
}

EnterpriseN is a Enterprise object, all fields are nullable

func (*EnterpriseN) As

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

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

func (*EnterpriseN) Delete

func (inst *EnterpriseN) Delete(ctx context.Context) error

Delete remove a enterprise

func (*EnterpriseN) Save

func (inst *EnterpriseN) Save(ctx context.Context, onlyFields ...string) error

Save create a new model or update it

func (*EnterpriseN) SetModel

func (inst *EnterpriseN) SetModel(enterpriseModel *EnterpriseModel)

SetModel set model for Enterprise

func (*EnterpriseN) Staled

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

Staled identify whether the object has been modified

func (*EnterpriseN) StaledKV

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

StaledKV return all fields has been modified

func (*EnterpriseN) String

func (inst *EnterpriseN) String() string

String convert instance to json string

func (*EnterpriseN) ToEnterprise

func (w *EnterpriseN) ToEnterprise() Enterprise

func (*EnterpriseN) Users

func (inst *EnterpriseN) Users() *EnterpriseHasManyUserRel

type Organization

type Organization struct {
	Id        int64
	Name      string
	CreatedAt time.Time
	UpdatedAt time.Time
}

func (Organization) As

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

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

func (Organization) ToOrganizationN

func (w Organization) ToOrganizationN(allows ...string) OrganizationN

type OrganizationBelongsToManyUserRel

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

func (*OrganizationBelongsToManyUserRel) Attach

func (rel *OrganizationBelongsToManyUserRel) Attach(ctx context.Context, target UserN) error

func (*OrganizationBelongsToManyUserRel) Count

func (*OrganizationBelongsToManyUserRel) Create

func (rel *OrganizationBelongsToManyUserRel) Create(ctx context.Context, target UserN, builders ...query.SQLBuilder) (int64, error)

func (*OrganizationBelongsToManyUserRel) Detach

func (rel *OrganizationBelongsToManyUserRel) Detach(ctx context.Context, target UserN) error

func (*OrganizationBelongsToManyUserRel) DetachAll

func (*OrganizationBelongsToManyUserRel) Exists

func (rel *OrganizationBelongsToManyUserRel) Exists(ctx context.Context, builders ...query.SQLBuilder) (bool, error)

func (*OrganizationBelongsToManyUserRel) Get

type OrganizationModel

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

OrganizationModel is a model which encapsulates the operations of the object

func NewOrganizationModel

func NewOrganizationModel(db query.Database) *OrganizationModel

NewOrganizationModel create a OrganizationModel

func (*OrganizationModel) Condition

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

Condition add query builder to model

func (*OrganizationModel) Count

func (m *OrganizationModel) Count(ctx context.Context, builders ...query.SQLBuilder) (int64, error)

Count return model count for a given query

func (*OrganizationModel) Create

func (m *OrganizationModel) Create(ctx context.Context, kv query.KV) (int64, error)

Create save a new organization to database

func (*OrganizationModel) Delete

func (m *OrganizationModel) Delete(ctx context.Context, builders ...query.SQLBuilder) (int64, error)

Delete remove a model

func (*OrganizationModel) DeleteById

func (m *OrganizationModel) DeleteById(ctx context.Context, id int64) (int64, error)

DeleteById remove a model by id

func (*OrganizationModel) Exists

func (m *OrganizationModel) Exists(ctx context.Context, builders ...query.SQLBuilder) (bool, error)

Exists return whether the records exists for a given query

func (*OrganizationModel) Find

Find retrieve a model by its primary key

func (*OrganizationModel) First

func (m *OrganizationModel) First(ctx context.Context, builders ...query.SQLBuilder) (*OrganizationN, error)

First return first result for given query

func (*OrganizationModel) Get

func (m *OrganizationModel) Get(ctx context.Context, builders ...query.SQLBuilder) ([]OrganizationN, error)

Get retrieve all results for given query

func (*OrganizationModel) GetDB

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

GetDB return database instance

func (*OrganizationModel) Paginate

func (m *OrganizationModel) Paginate(ctx context.Context, page int64, perPage int64, builders ...query.SQLBuilder) ([]OrganizationN, query.PaginateMeta, error)

func (*OrganizationModel) Save

func (m *OrganizationModel) Save(ctx context.Context, organization OrganizationN, onlyFields ...string) (int64, error)

Save save a organization to database

func (*OrganizationModel) SaveAll

func (m *OrganizationModel) SaveAll(ctx context.Context, organizations []OrganizationN) ([]int64, error)

SaveAll save all organizations to database

func (*OrganizationModel) SaveOrUpdate

func (m *OrganizationModel) SaveOrUpdate(ctx context.Context, organization OrganizationN, onlyFields ...string) (id int64, updated bool, err error)

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

func (*OrganizationModel) Update

func (m *OrganizationModel) Update(ctx context.Context, builder query.SQLBuilder, organization OrganizationN, onlyFields ...string) (int64, error)

Update update a model for given query

func (*OrganizationModel) UpdateById

func (m *OrganizationModel) UpdateById(ctx context.Context, id int64, organization OrganizationN, onlyFields ...string) (int64, error)

UpdateById update a model by id

func (*OrganizationModel) UpdateFields

func (m *OrganizationModel) UpdateFields(ctx context.Context, kv query.KV, builders ...query.SQLBuilder) (int64, error)

UpdateFields update kv for a given query

func (*OrganizationModel) WithLocalScopes

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

WithLocalScopes add a local scope for given query

func (*OrganizationModel) WithoutGlobalScopes

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

WithoutGlobalScopes remove a global scope for given query

type OrganizationN

type OrganizationN struct {
	Id        null.Int
	Name      null.String
	CreatedAt null.Time
	UpdatedAt null.Time
	// contains filtered or unexported fields
}

OrganizationN is a Organization object, all fields are nullable

func (*OrganizationN) As

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

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

func (*OrganizationN) Delete

func (inst *OrganizationN) Delete(ctx context.Context) error

Delete remove a organization

func (*OrganizationN) Save

func (inst *OrganizationN) Save(ctx context.Context, onlyFields ...string) error

Save create a new model or update it

func (*OrganizationN) SetModel

func (inst *OrganizationN) SetModel(organizationModel *OrganizationModel)

SetModel set model for Organization

func (*OrganizationN) Staled

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

Staled identify whether the object has been modified

func (*OrganizationN) StaledKV

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

StaledKV return all fields has been modified

func (*OrganizationN) String

func (inst *OrganizationN) String() string

String convert instance to json string

func (*OrganizationN) ToOrganization

func (w *OrganizationN) ToOrganization() Organization

func (*OrganizationN) Users

type PasswordReset

type PasswordReset struct {
	Email     string
	Token     string
	Id        int64
	CreatedAt time.Time
}

func (PasswordReset) As

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

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

func (PasswordReset) ToPasswordResetN

func (w PasswordReset) ToPasswordResetN(allows ...string) PasswordResetN

type PasswordResetModel

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

PasswordResetModel is a model which encapsulates the operations of the object

func NewPasswordResetModel

func NewPasswordResetModel(db query.Database) *PasswordResetModel

NewPasswordResetModel create a PasswordResetModel

func (*PasswordResetModel) Condition

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

Condition add query builder to model

func (*PasswordResetModel) Count

func (m *PasswordResetModel) Count(ctx context.Context, builders ...query.SQLBuilder) (int64, error)

Count return model count for a given query

func (*PasswordResetModel) Create

func (m *PasswordResetModel) Create(ctx context.Context, kv query.KV) (int64, error)

Create save a new PasswordReset to database

func (*PasswordResetModel) Delete

func (m *PasswordResetModel) Delete(ctx context.Context, builders ...query.SQLBuilder) (int64, error)

Delete remove a model

func (*PasswordResetModel) DeleteById

func (m *PasswordResetModel) DeleteById(ctx context.Context, id int64) (int64, error)

DeleteById remove a model by id

func (*PasswordResetModel) Exists

func (m *PasswordResetModel) Exists(ctx context.Context, builders ...query.SQLBuilder) (bool, error)

Exists return whether the records exists for a given query

func (*PasswordResetModel) Find

Find retrieve a model by its primary key

func (*PasswordResetModel) First

func (m *PasswordResetModel) First(ctx context.Context, builders ...query.SQLBuilder) (*PasswordResetN, error)

First return first result for given query

func (*PasswordResetModel) Get

func (m *PasswordResetModel) Get(ctx context.Context, builders ...query.SQLBuilder) ([]PasswordResetN, error)

Get retrieve all results for given query

func (*PasswordResetModel) GetDB

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

GetDB return database instance

func (*PasswordResetModel) Paginate

func (m *PasswordResetModel) Paginate(ctx context.Context, page int64, perPage int64, builders ...query.SQLBuilder) ([]PasswordResetN, query.PaginateMeta, error)

func (*PasswordResetModel) Save

func (m *PasswordResetModel) Save(ctx context.Context, passwordReset PasswordResetN, onlyFields ...string) (int64, error)

Save save a PasswordReset to database

func (*PasswordResetModel) SaveAll

func (m *PasswordResetModel) SaveAll(ctx context.Context, passwordResets []PasswordResetN) ([]int64, error)

SaveAll save all PasswordResets to database

func (*PasswordResetModel) SaveOrUpdate

func (m *PasswordResetModel) SaveOrUpdate(ctx context.Context, passwordReset PasswordResetN, onlyFields ...string) (id int64, updated bool, err error)

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

func (*PasswordResetModel) Update

func (m *PasswordResetModel) Update(ctx context.Context, builder query.SQLBuilder, passwordReset PasswordResetN, onlyFields ...string) (int64, error)

Update update a model for given query

func (*PasswordResetModel) UpdateById

func (m *PasswordResetModel) UpdateById(ctx context.Context, id int64, passwordReset PasswordResetN, onlyFields ...string) (int64, error)

UpdateById update a model by id

func (*PasswordResetModel) UpdateFields

func (m *PasswordResetModel) UpdateFields(ctx context.Context, kv query.KV, builders ...query.SQLBuilder) (int64, error)

UpdateFields update kv for a given query

func (*PasswordResetModel) WithLocalScopes

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

WithLocalScopes add a local scope for given query

func (*PasswordResetModel) WithoutGlobalScopes

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

WithoutGlobalScopes remove a global scope for given query

type PasswordResetN

type PasswordResetN struct {
	Email     null.String
	Token     null.String
	Id        null.Int
	CreatedAt null.Time
	// contains filtered or unexported fields
}

PasswordResetN is a PasswordReset object, all fields are nullable

func (*PasswordResetN) As

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

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

func (*PasswordResetN) Delete

func (inst *PasswordResetN) Delete(ctx context.Context) error

Delete remove a PasswordReset

func (*PasswordResetN) Save

func (inst *PasswordResetN) Save(ctx context.Context, onlyFields ...string) error

Save create a new model or update it

func (*PasswordResetN) SetModel

func (inst *PasswordResetN) SetModel(passwordResetModel *PasswordResetModel)

SetModel set model for PasswordReset

func (*PasswordResetN) Staled

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

Staled identify whether the object has been modified

func (*PasswordResetN) StaledKV

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

StaledKV return all fields has been modified

func (*PasswordResetN) String

func (inst *PasswordResetN) String() string

String convert instance to json string

func (*PasswordResetN) ToPasswordReset

func (w *PasswordResetN) ToPasswordReset() PasswordReset

type Role

type Role struct {
	Name        string
	Description string
	Id          int64
	CreatedAt   time.Time
	UpdatedAt   time.Time
}

func (Role) As

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

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

func (Role) ToRoleN

func (w Role) ToRoleN(allows ...string) RoleN

type RoleHasManyUserRel

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

func (*RoleHasManyUserRel) Count

func (rel *RoleHasManyUserRel) Count(ctx context.Context, builders ...query.SQLBuilder) (int64, error)

func (*RoleHasManyUserRel) Create

func (rel *RoleHasManyUserRel) Create(ctx context.Context, target UserN) (int64, error)

func (*RoleHasManyUserRel) Exists

func (rel *RoleHasManyUserRel) Exists(ctx context.Context, builders ...query.SQLBuilder) (bool, error)

func (*RoleHasManyUserRel) First

func (rel *RoleHasManyUserRel) First(ctx context.Context, builders ...query.SQLBuilder) (*UserN, error)

func (*RoleHasManyUserRel) Get

func (rel *RoleHasManyUserRel) Get(ctx context.Context, builders ...query.SQLBuilder) ([]UserN, error)

type RoleModel

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

RoleModel is a model which encapsulates the operations of the object

func NewRoleModel

func NewRoleModel(db query.Database) *RoleModel

NewRoleModel create a RoleModel

func (*RoleModel) Condition

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

Condition add query builder to model

func (*RoleModel) Count

func (m *RoleModel) Count(ctx context.Context, builders ...query.SQLBuilder) (int64, error)

Count return model count for a given query

func (*RoleModel) Create

func (m *RoleModel) Create(ctx context.Context, kv query.KV) (int64, error)

Create save a new Role to database

func (*RoleModel) Delete

func (m *RoleModel) Delete(ctx context.Context, builders ...query.SQLBuilder) (int64, error)

Delete remove a model

func (*RoleModel) DeleteById

func (m *RoleModel) DeleteById(ctx context.Context, id int64) (int64, error)

DeleteById remove a model by id

func (*RoleModel) Exists

func (m *RoleModel) Exists(ctx context.Context, builders ...query.SQLBuilder) (bool, error)

Exists return whether the records exists for a given query

func (*RoleModel) Find

func (m *RoleModel) Find(ctx context.Context, id int64) (*RoleN, error)

Find retrieve a model by its primary key

func (*RoleModel) First

func (m *RoleModel) First(ctx context.Context, builders ...query.SQLBuilder) (*RoleN, error)

First return first result for given query

func (*RoleModel) Get

func (m *RoleModel) Get(ctx context.Context, builders ...query.SQLBuilder) ([]RoleN, error)

Get retrieve all results for given query

func (*RoleModel) GetDB

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

GetDB return database instance

func (*RoleModel) Paginate

func (m *RoleModel) Paginate(ctx context.Context, page int64, perPage int64, builders ...query.SQLBuilder) ([]RoleN, query.PaginateMeta, error)

func (*RoleModel) Save

func (m *RoleModel) Save(ctx context.Context, role RoleN, onlyFields ...string) (int64, error)

Save save a Role to database

func (*RoleModel) SaveAll

func (m *RoleModel) SaveAll(ctx context.Context, roles []RoleN) ([]int64, error)

SaveAll save all Roles to database

func (*RoleModel) SaveOrUpdate

func (m *RoleModel) SaveOrUpdate(ctx context.Context, role RoleN, onlyFields ...string) (id int64, updated bool, err error)

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

func (*RoleModel) Update

func (m *RoleModel) Update(ctx context.Context, builder query.SQLBuilder, role RoleN, onlyFields ...string) (int64, error)

Update update a model for given query

func (*RoleModel) UpdateById

func (m *RoleModel) UpdateById(ctx context.Context, id int64, role RoleN, onlyFields ...string) (int64, error)

UpdateById update a model by id

func (*RoleModel) UpdateFields

func (m *RoleModel) UpdateFields(ctx context.Context, kv query.KV, builders ...query.SQLBuilder) (int64, error)

UpdateFields update kv for a given query

func (*RoleModel) WithLocalScopes

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

WithLocalScopes add a local scope for given query

func (*RoleModel) WithoutGlobalScopes

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

WithoutGlobalScopes remove a global scope for given query

type RoleN

type RoleN struct {
	Name        null.String
	Description null.String
	Id          null.Int
	CreatedAt   null.Time
	UpdatedAt   null.Time
	// contains filtered or unexported fields
}

RoleN is a Role object, all fields are nullable

func (*RoleN) As

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

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

func (*RoleN) Delete

func (inst *RoleN) Delete(ctx context.Context) error

Delete remove a Role

func (*RoleN) Save

func (inst *RoleN) Save(ctx context.Context, onlyFields ...string) error

Save create a new model or update it

func (*RoleN) SetModel

func (inst *RoleN) SetModel(roleModel *RoleModel)

SetModel set model for Role

func (*RoleN) Staled

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

Staled identify whether the object has been modified

func (*RoleN) StaledKV

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

StaledKV return all fields has been modified

func (*RoleN) String

func (inst *RoleN) String() string

String convert instance to json string

func (*RoleN) ToRole

func (w *RoleN) ToRole() Role

func (*RoleN) Users

func (inst *RoleN) Users() *RoleHasManyUserRel

type User

type User struct {
	Id            int64
	Name          string
	Email         string
	Password      string
	RoleId        int64
	EnterpriseId  int64
	RememberToken string
	CreatedAt     time.Time
	UpdatedAt     time.Time
	DeletedAt     time.Time
}

func (User) As

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

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

func (User) ToUserN

func (w User) ToUserN(allows ...string) UserN

type UserBelongsToEnterpriseRel

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

func (*UserBelongsToEnterpriseRel) Associate

func (rel *UserBelongsToEnterpriseRel) Associate(ctx context.Context, target EnterpriseN) error

func (*UserBelongsToEnterpriseRel) Create

func (rel *UserBelongsToEnterpriseRel) Create(ctx context.Context, target EnterpriseN) (int64, error)

func (*UserBelongsToEnterpriseRel) Dissociate

func (rel *UserBelongsToEnterpriseRel) Dissociate(ctx context.Context) error

func (*UserBelongsToEnterpriseRel) Exists

func (rel *UserBelongsToEnterpriseRel) Exists(ctx context.Context, builders ...query.SQLBuilder) (bool, error)

func (*UserBelongsToEnterpriseRel) First

func (rel *UserBelongsToEnterpriseRel) First(ctx context.Context, builders ...query.SQLBuilder) (*EnterpriseN, error)

type UserBelongsToManyOrganizationRel

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

func (*UserBelongsToManyOrganizationRel) Attach

func (*UserBelongsToManyOrganizationRel) Count

func (*UserBelongsToManyOrganizationRel) Create

func (rel *UserBelongsToManyOrganizationRel) Create(ctx context.Context, target OrganizationN, builders ...query.SQLBuilder) (int64, error)

func (*UserBelongsToManyOrganizationRel) Detach

func (*UserBelongsToManyOrganizationRel) DetachAll

func (*UserBelongsToManyOrganizationRel) Exists

func (rel *UserBelongsToManyOrganizationRel) Exists(ctx context.Context, builders ...query.SQLBuilder) (bool, error)

func (*UserBelongsToManyOrganizationRel) Get

type UserBelongsToRoleRel

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

func (*UserBelongsToRoleRel) Associate

func (rel *UserBelongsToRoleRel) Associate(ctx context.Context, target RoleN) error

func (*UserBelongsToRoleRel) Create

func (rel *UserBelongsToRoleRel) Create(ctx context.Context, target RoleN) (int64, error)

func (*UserBelongsToRoleRel) Dissociate

func (rel *UserBelongsToRoleRel) Dissociate(ctx context.Context) error

func (*UserBelongsToRoleRel) Exists

func (rel *UserBelongsToRoleRel) Exists(ctx context.Context, builders ...query.SQLBuilder) (bool, error)

func (*UserBelongsToRoleRel) First

func (rel *UserBelongsToRoleRel) First(ctx context.Context, builders ...query.SQLBuilder) (*RoleN, error)

type UserExt

type UserExt struct {
	Address   string
	Qq        string
	Wechat    string
	UserId    int64
	Id        int64
	CreatedAt time.Time
	UpdatedAt time.Time
}

func (UserExt) As

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

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

func (UserExt) ToUserExtN

func (w UserExt) ToUserExtN(allows ...string) UserExtN

type UserExtBelongsToUserRel

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

func (*UserExtBelongsToUserRel) Associate

func (rel *UserExtBelongsToUserRel) Associate(ctx context.Context, target UserN) error

func (*UserExtBelongsToUserRel) Create

func (rel *UserExtBelongsToUserRel) Create(ctx context.Context, target UserN) (int64, error)

func (*UserExtBelongsToUserRel) Dissociate

func (rel *UserExtBelongsToUserRel) Dissociate(ctx context.Context) error

func (*UserExtBelongsToUserRel) Exists

func (rel *UserExtBelongsToUserRel) Exists(ctx context.Context, builders ...query.SQLBuilder) (bool, error)

func (*UserExtBelongsToUserRel) First

func (rel *UserExtBelongsToUserRel) First(ctx context.Context, builders ...query.SQLBuilder) (*UserN, error)

type UserExtModel

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

UserExtModel is a model which encapsulates the operations of the object

func NewUserExtModel

func NewUserExtModel(db query.Database) *UserExtModel

NewUserExtModel create a UserExtModel

func (*UserExtModel) Condition

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

Condition add query builder to model

func (*UserExtModel) Count

func (m *UserExtModel) Count(ctx context.Context, builders ...query.SQLBuilder) (int64, error)

Count return model count for a given query

func (*UserExtModel) Create

func (m *UserExtModel) Create(ctx context.Context, kv query.KV) (int64, error)

Create save a new UserExt to database

func (*UserExtModel) Delete

func (m *UserExtModel) Delete(ctx context.Context, builders ...query.SQLBuilder) (int64, error)

Delete remove a model

func (*UserExtModel) DeleteById

func (m *UserExtModel) DeleteById(ctx context.Context, id int64) (int64, error)

DeleteById remove a model by id

func (*UserExtModel) Exists

func (m *UserExtModel) Exists(ctx context.Context, builders ...query.SQLBuilder) (bool, error)

Exists return whether the records exists for a given query

func (*UserExtModel) Find

func (m *UserExtModel) Find(ctx context.Context, id int64) (*UserExtN, error)

Find retrieve a model by its primary key

func (*UserExtModel) First

func (m *UserExtModel) First(ctx context.Context, builders ...query.SQLBuilder) (*UserExtN, error)

First return first result for given query

func (*UserExtModel) Get

func (m *UserExtModel) Get(ctx context.Context, builders ...query.SQLBuilder) ([]UserExtN, error)

Get retrieve all results for given query

func (*UserExtModel) GetDB

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

GetDB return database instance

func (*UserExtModel) Paginate

func (m *UserExtModel) Paginate(ctx context.Context, page int64, perPage int64, builders ...query.SQLBuilder) ([]UserExtN, query.PaginateMeta, error)

func (*UserExtModel) Save

func (m *UserExtModel) Save(ctx context.Context, userExt UserExtN, onlyFields ...string) (int64, error)

Save save a UserExt to database

func (*UserExtModel) SaveAll

func (m *UserExtModel) SaveAll(ctx context.Context, userExts []UserExtN) ([]int64, error)

SaveAll save all UserExts to database

func (*UserExtModel) SaveOrUpdate

func (m *UserExtModel) SaveOrUpdate(ctx context.Context, userExt UserExtN, onlyFields ...string) (id int64, updated bool, err error)

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

func (*UserExtModel) Update

func (m *UserExtModel) Update(ctx context.Context, builder query.SQLBuilder, userExt UserExtN, onlyFields ...string) (int64, error)

Update update a model for given query

func (*UserExtModel) UpdateById

func (m *UserExtModel) UpdateById(ctx context.Context, id int64, userExt UserExtN, onlyFields ...string) (int64, error)

UpdateById update a model by id

func (*UserExtModel) UpdateFields

func (m *UserExtModel) UpdateFields(ctx context.Context, kv query.KV, builders ...query.SQLBuilder) (int64, error)

UpdateFields update kv for a given query

func (*UserExtModel) WithLocalScopes

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

WithLocalScopes add a local scope for given query

func (*UserExtModel) WithoutGlobalScopes

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

WithoutGlobalScopes remove a global scope for given query

type UserExtN

type UserExtN struct {
	Address   null.String
	Qq        null.String
	Wechat    null.String
	UserId    null.Int
	Id        null.Int
	CreatedAt null.Time
	UpdatedAt null.Time
	// contains filtered or unexported fields
}

UserExtN is a UserExt object, all fields are nullable

func (*UserExtN) As

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

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

func (*UserExtN) Delete

func (inst *UserExtN) Delete(ctx context.Context) error

Delete remove a UserExt

func (*UserExtN) Save

func (inst *UserExtN) Save(ctx context.Context, onlyFields ...string) error

Save create a new model or update it

func (*UserExtN) SetModel

func (inst *UserExtN) SetModel(userExtModel *UserExtModel)

SetModel set model for UserExt

func (*UserExtN) Staled

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

Staled identify whether the object has been modified

func (*UserExtN) StaledKV

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

StaledKV return all fields has been modified

func (*UserExtN) String

func (inst *UserExtN) String() string

String convert instance to json string

func (*UserExtN) ToUserExt

func (w *UserExtN) ToUserExt() UserExt

func (*UserExtN) User

func (inst *UserExtN) User() *UserExtBelongsToUserRel

type UserHasOneUserExtRel

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

func (*UserHasOneUserExtRel) Associate

func (rel *UserHasOneUserExtRel) Associate(ctx context.Context, target UserExtN) error

func (*UserHasOneUserExtRel) Create

func (rel *UserHasOneUserExtRel) Create(ctx context.Context, target UserExtN) (int64, error)

func (*UserHasOneUserExtRel) Dissociate

func (rel *UserHasOneUserExtRel) Dissociate(ctx context.Context) error

func (*UserHasOneUserExtRel) Exists

func (rel *UserHasOneUserExtRel) Exists(ctx context.Context, builders ...query.SQLBuilder) (bool, error)

func (*UserHasOneUserExtRel) First

func (rel *UserHasOneUserExtRel) First(ctx context.Context, builders ...query.SQLBuilder) (*UserExtN, error)

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(ctx context.Context, builders ...query.SQLBuilder) (int64, error)

Count return model count for a given query

func (*UserModel) Create

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

Create save a new User to database

func (*UserModel) Delete

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

Delete remove a model

func (*UserModel) DeleteById

func (m *UserModel) DeleteById(ctx context.Context, id int64) (int64, error)

DeleteById remove a model by id

func (*UserModel) Exists

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

Exists return whether the records exists for a given query

func (*UserModel) Find

func (m *UserModel) Find(ctx context.Context, id int64) (*UserN, error)

Find retrieve a model by its primary key

func (*UserModel) First

func (m *UserModel) First(ctx context.Context, builders ...query.SQLBuilder) (*UserN, error)

First return first result for given query

func (*UserModel) ForceDelete

func (m *UserModel) ForceDelete(ctx context.Context, builders ...query.SQLBuilder) (int64, error)

ForceDelete permanently remove a soft deleted model from the database

func (*UserModel) ForceDeleteById

func (m *UserModel) ForceDeleteById(ctx context.Context, id int64) (int64, error)

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

func (*UserModel) Get

func (m *UserModel) Get(ctx context.Context, builders ...query.SQLBuilder) ([]UserN, 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(ctx context.Context, page int64, perPage int64, builders ...query.SQLBuilder) ([]UserN, query.PaginateMeta, error)

func (*UserModel) Restore

func (m *UserModel) Restore(ctx context.Context, builders ...query.SQLBuilder) (int64, error)

Restore restore a soft deleted model into an active state

func (*UserModel) RestoreById

func (m *UserModel) RestoreById(ctx context.Context, id int64) (int64, error)

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

func (*UserModel) Save

func (m *UserModel) Save(ctx context.Context, user UserN, onlyFields ...string) (int64, error)

Save save a User to database

func (*UserModel) SaveAll

func (m *UserModel) SaveAll(ctx context.Context, users []UserN) ([]int64, error)

SaveAll save all Users to database

func (*UserModel) SaveOrUpdate

func (m *UserModel) SaveOrUpdate(ctx context.Context, user UserN, 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(ctx context.Context, builder query.SQLBuilder, user UserN, onlyFields ...string) (int64, error)

Update update a model for given query

func (*UserModel) UpdateById

func (m *UserModel) UpdateById(ctx context.Context, id int64, user UserN, onlyFields ...string) (int64, error)

UpdateById update a model by id

func (*UserModel) UpdateFields

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

UpdateFields update kv for a given query

func (*UserModel) WithLocalScopes

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

WithLocalScopes add a local scope for given query

func (*UserModel) WithTrashed

func (m *UserModel) WithTrashed() *UserModel

WithTrashed force soft deleted models to appear in a result set

func (*UserModel) WithoutGlobalScopes

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

WithoutGlobalScopes remove a global scope for given query

type UserN

type UserN struct {
	Id            null.Int `json:"id"`
	Name          null.String
	Email         null.String `json:"email"`
	Password      null.String `json:"password" yaml:"password"`
	RoleId        null.Int
	EnterpriseId  null.Int
	RememberToken null.String `json:"remember_token" yaml:"remember_token"`
	CreatedAt     null.Time
	UpdatedAt     null.Time
	DeletedAt     null.Time
	// contains filtered or unexported fields
}

UserN is a User object, all fields are nullable

func (*UserN) As

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

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

func (*UserN) Delete

func (inst *UserN) Delete(ctx context.Context) error

Delete remove a User

func (*UserN) Enterprise

func (inst *UserN) Enterprise() *UserBelongsToEnterpriseRel

func (*UserN) Organizations

func (inst *UserN) Organizations() *UserBelongsToManyOrganizationRel

func (*UserN) Role

func (inst *UserN) Role() *UserBelongsToRoleRel

func (*UserN) Save

func (inst *UserN) Save(ctx context.Context, onlyFields ...string) error

Save create a new model or update it

func (*UserN) SetModel

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

SetModel set model for User

func (*UserN) Staled

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

Staled identify whether the object has been modified

func (*UserN) StaledKV

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

StaledKV return all fields has been modified

func (*UserN) String

func (inst *UserN) String() string

String convert instance to json string

func (*UserN) ToUser

func (w *UserN) ToUser() User

func (*UserN) UserExt

func (inst *UserN) UserExt() *UserHasOneUserExtRel

Jump to

Keyboard shortcuts

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