model

package
v0.0.0-...-15bed1d Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2022 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package model is a generated GoMock package.

Package model is a generated GoMock package.

Index

Constants

View Source
const (
	CoinType   = 1
	NuggetType = 2
	ExpType    = 3
)
View Source
const (
	RedisJwtPrefix = "jwt"
)

Variables

This section is empty.

Functions

func MapDecode

func MapDecode(tagName string, input, output interface{}) error

func UseCache

func UseCache(b bool) func() bool

Types

type DBTable

type DBTable interface {
	TableName() string
	PK() string
}

type GormMethodSet

type GormMethodSet[table DBTable] interface {
	Create(table) error
	Update(table) error
	Delete(pk string) error
	Get(pk string) (ret table, has bool, err error)
}

func NewGormDao

func NewGormDao[table DBTable](ctx context.Context, db *gorm.DB, opts ...Option) GormMethodSet[table]

type GormModel

type GormModel struct {
	UserID    string
	CreatedAt time.Time
	UpdatedAt time.Time
}

func (GormModel) PK

func (u GormModel) PK() string

type MockDBTable

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

MockDBTable is a mock of DBTable interface.

func NewMockDBTable

func NewMockDBTable(ctrl *gomock.Controller) *MockDBTable

NewMockDBTable creates a new mock instance.

func (*MockDBTable) EXPECT

func (m *MockDBTable) EXPECT() *MockDBTableMockRecorder

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockDBTable) PK

func (m *MockDBTable) PK() string

PK mocks base method.

func (*MockDBTable) TableName

func (m *MockDBTable) TableName() string

TableName mocks base method.

type MockDBTableMockRecorder

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

MockDBTableMockRecorder is the mock recorder for MockDBTable.

func (*MockDBTableMockRecorder) PK

PK indicates an expected call of PK.

func (*MockDBTableMockRecorder) TableName

func (mr *MockDBTableMockRecorder) TableName() *gomock.Call

TableName indicates an expected call of TableName.

type MockGormMethodSet

type MockGormMethodSet[table DBTable] struct {
	// contains filtered or unexported fields
}

MockGormMethodSet is a mock of GormMethodSet interface.

func NewMockGormMethodSet

func NewMockGormMethodSet[table DBTable](ctrl *gomock.Controller) *MockGormMethodSet[table]

NewMockGormMethodSet creates a new mock instance.

func (*MockGormMethodSet[table]) Create

func (m *MockGormMethodSet[table]) Create(arg0 table) error

Create mocks base method.

func (*MockGormMethodSet[table]) Delete

func (m *MockGormMethodSet[table]) Delete(pk string) error

Delete mocks base method.

func (*MockGormMethodSet[table]) EXPECT

func (m *MockGormMethodSet[table]) EXPECT() *MockGormMethodSetMockRecorder[table]

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockGormMethodSet[table]) Get

func (m *MockGormMethodSet[table]) Get(pk string) (table, bool, error)

Get mocks base method.

func (*MockGormMethodSet[table]) Update

func (m *MockGormMethodSet[table]) Update(arg0 table) error

Update mocks base method.

type MockGormMethodSetMockRecorder

type MockGormMethodSetMockRecorder[table DBTable] struct {
	// contains filtered or unexported fields
}

MockGormMethodSetMockRecorder is the mock recorder for MockGormMethodSet.

func (*MockGormMethodSetMockRecorder[table]) Create

func (mr *MockGormMethodSetMockRecorder[table]) Create(arg0 interface{}) *gomock.Call

Create indicates an expected call of Create.

func (*MockGormMethodSetMockRecorder[table]) Delete

func (mr *MockGormMethodSetMockRecorder[table]) Delete(pk interface{}) *gomock.Call

Delete indicates an expected call of Delete.

func (*MockGormMethodSetMockRecorder[table]) Get

func (mr *MockGormMethodSetMockRecorder[table]) Get(pk interface{}) *gomock.Call

Get indicates an expected call of Get.

func (*MockGormMethodSetMockRecorder[table]) Update

func (mr *MockGormMethodSetMockRecorder[table]) Update(arg0 interface{}) *gomock.Call

Update indicates an expected call of Update.

type MockRedisMethodSet

type MockRedisMethodSet[table DBTable] struct {
	// contains filtered or unexported fields
}

MockRedisMethodSet is a mock of RedisMethodSet interface.

func NewMockRedisMethodSet

func NewMockRedisMethodSet[table DBTable](ctrl *gomock.Controller) *MockRedisMethodSet[table]

NewMockRedisMethodSet creates a new mock instance.

func (*MockRedisMethodSet[table]) Del

func (m *MockRedisMethodSet[table]) Del(ctx context.Context, pk string) (int64, error)

Del mocks base method.

func (*MockRedisMethodSet[table]) EXPECT

func (m *MockRedisMethodSet[table]) EXPECT() *MockRedisMethodSetMockRecorder[table]

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockRedisMethodSet[table]) Get

func (m *MockRedisMethodSet[table]) Get(ctx context.Context, pk string) (table, bool, error)

Get mocks base method.

func (*MockRedisMethodSet[table]) HGet

func (m *MockRedisMethodSet[table]) HGet(ctx context.Context, pk, k string) (string, error)

HGet mocks base method.

func (*MockRedisMethodSet[table]) HGetAll

func (m *MockRedisMethodSet[table]) HGetAll(ctx context.Context, pk string) (table, bool, error)

HGetAll mocks base method.

func (*MockRedisMethodSet[table]) HMSet

func (m *MockRedisMethodSet[table]) HMSet(ctx context.Context, u table) error

HMSet mocks base method.

func (*MockRedisMethodSet[table]) HSet

func (m *MockRedisMethodSet[table]) HSet(ctx context.Context, pk, k, v string) error

HSet mocks base method.

func (*MockRedisMethodSet[table]) Set

func (m *MockRedisMethodSet[table]) Set(ctx context.Context, u table) error

Set mocks base method.

type MockRedisMethodSetMockRecorder

type MockRedisMethodSetMockRecorder[table DBTable] struct {
	// contains filtered or unexported fields
}

MockRedisMethodSetMockRecorder is the mock recorder for MockRedisMethodSet.

func (*MockRedisMethodSetMockRecorder[table]) Del

func (mr *MockRedisMethodSetMockRecorder[table]) Del(ctx, pk interface{}) *gomock.Call

Del indicates an expected call of Del.

func (*MockRedisMethodSetMockRecorder[table]) Get

func (mr *MockRedisMethodSetMockRecorder[table]) Get(ctx, pk interface{}) *gomock.Call

Get indicates an expected call of Get.

func (*MockRedisMethodSetMockRecorder[table]) HGet

func (mr *MockRedisMethodSetMockRecorder[table]) HGet(ctx, pk, k interface{}) *gomock.Call

HGet indicates an expected call of HGet.

func (*MockRedisMethodSetMockRecorder[table]) HGetAll

func (mr *MockRedisMethodSetMockRecorder[table]) HGetAll(ctx, pk interface{}) *gomock.Call

HGetAll indicates an expected call of HGetAll.

func (*MockRedisMethodSetMockRecorder[table]) HMSet

func (mr *MockRedisMethodSetMockRecorder[table]) HMSet(ctx, u interface{}) *gomock.Call

HMSet indicates an expected call of HMSet.

func (*MockRedisMethodSetMockRecorder[table]) HSet

func (mr *MockRedisMethodSetMockRecorder[table]) HSet(ctx, pk, k, v interface{}) *gomock.Call

HSet indicates an expected call of HSet.

func (*MockRedisMethodSetMockRecorder[table]) Set

func (mr *MockRedisMethodSetMockRecorder[table]) Set(ctx, u interface{}) *gomock.Call

Set indicates an expected call of Set.

type Option

type Option func() bool

type RedisCacheService

type RedisCacheService interface {
	GetCache(ctx context.Context, key string) (string, bool, error)
	SetCache(ctx context.Context, key string, value string, duration time.Duration) error
	DelCache(ctx context.Context, key string) (int64, error)
}

func NewRedisCacheService

func NewRedisCacheService(ctx context.Context, prefix string) RedisCacheService

type RedisMethodSet

type RedisMethodSet[table DBTable] interface {
	// Get str
	Get(ctx context.Context, pk string) (u table, has bool, err error)
	Set(ctx context.Context, u table) (err error)
	Del(ctx context.Context, pk string) (int64, error)
	// HSet hash
	HSet(ctx context.Context, pk string, k, v string) error
	HGetAll(ctx context.Context, pk string) (u table, has bool, err error)
	HGet(ctx context.Context, pk, k string) (v string, err error)
	HMSet(ctx context.Context, u table) error
}

func NewRedisDao

func NewRedisDao[table DBTable](ctx context.Context) RedisMethodSet[table]

type RedisModel

type RedisModel struct {
	UserID    string           `json:"user_id" gorm:"user_id;primaryKey"`
	UpdatedAt utils.Timestamps `json:"updated_at"`
}

func (RedisModel) PK

func (u RedisModel) PK() string

type UserAsset

type UserAsset struct {
	GormModel
	Coin        int `json:"coin"`
	TotalCoin   int `json:"total_coin"`
	Nugget      int `json:"nugget"`
	TotalNugget int `json:"total_nugget"`
	Exp         int `json:"exp"`
	TotalExp    int `json:"total_exp"`
}

func (UserAsset) ChangeValue

func (u UserAsset) ChangeValue(tp int, value int) (int, UserAsset, error)

func (UserAsset) TableName

func (UserAsset) TableName() string

type UserAssetHistory

type UserAssetHistory struct {
	ID string `gorm:"id"`
	GormModel
	CurrencyType int `gorm:"currency_type"`
	EventType    int `gorm:"event_type"`
	ItemID       int `gorm:"item_id"`
	Value        int `gorm:"value"`
	Total        int `gorm:"total"`
}

func (UserAssetHistory) PK

func (u UserAssetHistory) PK() string

func (UserAssetHistory) TableName

func (UserAssetHistory) TableName() string

type UserModel

type UserModel struct {
	RedisModel
	CreatedAt      utils.Timestamps `json:"created_at,omitempty" gorm:"created_at"`
	UserToken      string           `json:"user_token" gorm:"user_token"`
	HeadImageUrl   string           `json:"head_image_url" gorm:"head_image_url"`
	UserName       string           `json:"user_name" gorm:"user_name"`
	DeviceId       string           `json:"device_id" gorm:"device_id"`
	CustomerUserID string           `json:"customer_user_id"`
	WxId           string           `json:"wx_id" gorm:"wx_id"`
	ConfigID       int              `json:"config_id" gorm:"config_id"`
	Status         int              `json:"status"`
	Reason         string           `json:"reason"`
	FirstVersion   string           `json:"first_version" gorm:"first_version"`
	CurrentVersion string           `json:"current_version" gorm:"current_version"`
}

func (UserModel) TableName

func (UserModel) TableName() string

Jump to

Keyboard shortcuts

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