data

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2022 License: Apache-2.0 Imports: 25 Imported by: 3 modules, 2 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Data

Documentation

Index

Constants

This section is empty.

Variables

ProviderSet is data providers.

Functions

func GetDb

func GetDb(ctx context.Context, provider gorm.DbProvider) *g.DB

func NewEnforcerProvider

func NewEnforcerProvider(logger log.Logger, dbProvider gorm.DbProvider) (*casbin.EnforcerProvider, error)

func NewRefreshTokenRepo

func NewRefreshTokenRepo(data *Data) biz.RefreshTokenRepo

func NewRoleRepo

func NewRoleRepo(data *Data, eventbus *eventbus.EventBus) biz.RoleRepo

func NewUserAddrRepo

func NewUserAddrRepo(data *Data, eventbus *eventbus.EventBus) biz.UserAddressRepo

func NewUserRepo

func NewUserRepo(data *Data) biz.UserRepo

func NewUserSettingRepo

func NewUserSettingRepo(data *Data, eventbus *eventbus.EventBus) biz.UserSettingRepo

func NewUserTenantRepo

func NewUserTenantRepo(data *Data) biz.UserTenantRepo

func NewUserTokenRepo

func NewUserTokenRepo(data *Data) biz.UserTokenRepo

Types

type Data

type Data struct {
	DbProvider gorm.DbProvider
}

Data .

func NewData

func NewData(c *conf2.Data, dbProvider gorm.DbProvider, logger log.Logger) (*Data, func(), error)

NewData .

type Migrate

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

func NewMigrate

func NewMigrate(data *Data) *Migrate

func (*Migrate) Seed

func (m *Migrate) Seed(ctx context.Context, sCtx *seed.Context) error

type RefreshTokenRepo

type RefreshTokenRepo struct {
	Repo
}

func (*RefreshTokenRepo) Create

func (r *RefreshTokenRepo) Create(ctx context.Context, t *biz.RefreshToken) (err error)

func (*RefreshTokenRepo) Find

func (r *RefreshTokenRepo) Find(ctx context.Context, token string, validOnly bool) (*biz.RefreshToken, error)

func (*RefreshTokenRepo) Revoke

func (r *RefreshTokenRepo) Revoke(ctx context.Context, token string, used bool) (err error)

type Repo

type Repo struct {
	DbProvider gorm.DbProvider
}

func (*Repo) GetDb

func (r *Repo) GetDb(ctx context.Context) *g.DB

type RoleRepo

type RoleRepo struct {
	*kitgorm.Repo[biz.Role, string, v12.ListRolesRequest]
}

func (*RoleRepo) BuildFilterScope

func (r *RoleRepo) BuildFilterScope(q *v12.ListRolesRequest) func(db *gorm.DB) *gorm.DB

BuildFilterScope filter

func (*RoleRepo) DefaultSorting

func (r *RoleRepo) DefaultSorting() []string

DefaultSorting get default sorting

func (*RoleRepo) FindByName

func (r *RoleRepo) FindByName(ctx context.Context, name string) (*biz.Role, error)

func (*RoleRepo) GetDb

func (r *RoleRepo) GetDb(ctx context.Context) *gorm.DB

type UserAddrRepo

type UserAddrRepo struct {
	*kitgorm.Repo[biz.UserAddress, string, interface{}]
}

func (*UserAddrRepo) FindByUser

func (u *UserAddrRepo) FindByUser(ctx context.Context, userId string) ([]*biz.UserAddress, error)

func (*UserAddrRepo) GetDb

func (u *UserAddrRepo) GetDb(ctx context.Context) *gorm.DB

func (*UserAddrRepo) SetPrefer

func (u *UserAddrRepo) SetPrefer(ctx context.Context, addr *biz.UserAddress) error

type UserRepo

type UserRepo struct {
	Repo
}

func (*UserRepo) AddLogin

func (u *UserRepo) AddLogin(ctx context.Context, user *biz.User, userLogin *biz.UserLogin) error

func (*UserRepo) AddToRole

func (u *UserRepo) AddToRole(ctx context.Context, user *biz.User, role *biz.Role) error

func (*UserRepo) Count

func (u *UserRepo) Count(ctx context.Context, query *v1.UserFilter) (total int64, filtered int64, err error)

func (*UserRepo) Create

func (u *UserRepo) Create(ctx context.Context, user *biz.User) error

func (*UserRepo) Delete

func (u *UserRepo) Delete(ctx context.Context, user *biz.User) error

func (*UserRepo) FindByEmail

func (u *UserRepo) FindByEmail(ctx context.Context, email string) (*biz.User, error)

func (*UserRepo) FindByID

func (u *UserRepo) FindByID(ctx context.Context, id string) (*biz.User, error)

func (*UserRepo) FindByLogin

func (u *UserRepo) FindByLogin(ctx context.Context, loginProvider string, providerKey string) (*biz.User, error)

func (*UserRepo) FindByName

func (u *UserRepo) FindByName(ctx context.Context, name string) (*biz.User, error)

func (*UserRepo) FindByPhone

func (u *UserRepo) FindByPhone(ctx context.Context, phone string) (*biz.User, error)

func (*UserRepo) GetDb

func (u *UserRepo) GetDb(ctx context.Context) *gorm.DB

func (*UserRepo) GetRoles

func (u *UserRepo) GetRoles(ctx context.Context, user *biz.User) ([]biz.Role, error)

func (*UserRepo) GetToken

func (u *UserRepo) GetToken(ctx context.Context, user *biz.User, loginProvider string, name string) (token *string, err error)

func (*UserRepo) List

func (u *UserRepo) List(ctx context.Context, query *v1.ListUsersRequest) ([]*biz.User, error)

func (*UserRepo) ListLogin

func (u *UserRepo) ListLogin(ctx context.Context, user *biz.User) (userLogins []*biz.UserLogin, err error)

func (*UserRepo) RemoveFromRole

func (u *UserRepo) RemoveFromRole(ctx context.Context, user *biz.User, role *biz.Role) error

func (*UserRepo) RemoveLogin

func (u *UserRepo) RemoveLogin(ctx context.Context, user *biz.User, loginProvider string, providerKey string) error

func (*UserRepo) RemoveToken

func (u *UserRepo) RemoveToken(ctx context.Context, user *biz.User, loginProvider string, name string) (err error)

func (*UserRepo) SetToken

func (u *UserRepo) SetToken(ctx context.Context, user *biz.User, loginProvider string, name string, value string) (err error)

func (*UserRepo) Update

func (u *UserRepo) Update(ctx context.Context, user *biz.User, p *fieldmaskpb.FieldMask) error

func (*UserRepo) UpdateRoles

func (u *UserRepo) UpdateRoles(ctx context.Context, user *biz.User, roles []biz.Role) error

type UserSettingRepo

type UserSettingRepo struct {
	*kitgorm.Repo[biz.UserSetting, string, v1.GetSettingsRequest]
}

func (*UserSettingRepo) BuildFilterScope

func (r *UserSettingRepo) BuildFilterScope(q *v1.GetSettingsRequest) func(db *gorm.DB) *gorm.DB

BuildFilterScope filter

func (*UserSettingRepo) FindByUser

func (r *UserSettingRepo) FindByUser(ctx context.Context, userId string, query *v1.GetSettingsRequest) ([]*biz.UserSetting, error)

func (*UserSettingRepo) GetDb

func (r *UserSettingRepo) GetDb(ctx context.Context) *gorm.DB

func (*UserSettingRepo) UpdateByUser

func (r *UserSettingRepo) UpdateByUser(ctx context.Context, userId string, updateBatch []biz.UpdateUserSetting) error

type UserTenantRepo

type UserTenantRepo struct {
	Repo
}

func (*UserTenantRepo) Get

func (u *UserTenantRepo) Get(ctx context.Context, userId string, tenantId string) (*biz.UserTenant, error)

func (*UserTenantRepo) IsIn

func (u *UserTenantRepo) IsIn(ctx context.Context, userId string, tenantId string) (bool, error)

func (*UserTenantRepo) JoinTenant

func (u *UserTenantRepo) JoinTenant(ctx context.Context, userId string, tenantId string, status biz.UserTenantStatus) (*biz.UserTenant, error)

func (*UserTenantRepo) RemoveFromTenant

func (u *UserTenantRepo) RemoveFromTenant(ctx context.Context, userId string, tenantId string) error

func (*UserTenantRepo) Update

func (u *UserTenantRepo) Update(ctx context.Context, userTenant *biz.UserTenant) error

type UserTokenRepo

type UserTokenRepo struct {
	Repo
}

func (*UserTokenRepo) Create

func (u *UserTokenRepo) Create(ctx context.Context, userId, loginProvider, name, value string) (*biz.UserToken, error)

func (*UserTokenRepo) DeleteByUserIdAndLoginProvider

func (u *UserTokenRepo) DeleteByUserIdAndLoginProvider(ctx context.Context, userId, loginProvider string) error

func (*UserTokenRepo) DeleteByUserIdAndLoginProviderAndName

func (u *UserTokenRepo) DeleteByUserIdAndLoginProviderAndName(ctx context.Context, userId, loginProvider, name string) error

func (*UserTokenRepo) FindByUserIdAndLoginProvider

func (u *UserTokenRepo) FindByUserIdAndLoginProvider(ctx context.Context, userId, loginProvider string) ([]*biz.UserToken, error)

func (*UserTokenRepo) FindByUserIdAndLoginProviderAndName

func (u *UserTokenRepo) FindByUserIdAndLoginProviderAndName(ctx context.Context, userId, loginProvider, name string) (*biz.UserToken, error)

Jump to

Keyboard shortcuts

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