vip

package
v0.0.0-...-83adff0 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2020 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Dao

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

Dao vip dao

func New

func New(c *conf.Config) (dao *Dao)

New new vip dao

func (*Dao) AddVip

func (d *Dao) AddVip(ctx context.Context, uid int64, vipTime, sVipTime xtime.Time) (row int64, err error)

AddVip update user_n vip fields, add vip/svip time weather add vip or svip, vipTime should not be empty

func (*Dao) ClearCache

func (d *Dao) ClearCache(ctx context.Context, uid int64) (err error)

ClearCache clear user's vip and level field cache Todo: remove level attr

func (*Dao) Close

func (d *Dao) Close()

Close close the resource.

func (*Dao) CreateApVipRecord

func (d *Dao) CreateApVipRecord(ctx context.Context, record *model.VipRecord) (row int64, err error)

CreateApVipRecord create ap_vip_record

func (*Dao) CreateVipRecord

func (d *Dao) CreateVipRecord(ctx context.Context, req *model.VipBuy) (recordID int64, err error)

CreateVipRecord create user vip record if not exists return error maybe unique key exists err or other db error, upper business should notice unique key is (uid,order_id)

func (*Dao) GetVipFromCache

func (d *Dao) GetVipFromCache(ctx context.Context, uid int64) (info *model.VipInfo, err error)

GetVipFromCache get user vip info from cache

func (*Dao) GetVipFromDB

func (d *Dao) GetVipFromDB(ctx context.Context, uid int64) (info *model.VipInfo, err error)

GetVipFromDB get vip info by uid return error maybe sql no row or just scan error, how to handle decided by upper business

func (*Dao) Ping

func (d *Dao) Ping(ctx context.Context) error

Ping dao ping

func (*Dao) SetVipCache

func (d *Dao) SetVipCache(ctx context.Context, uid int64, info *model.VipInfo) (err error)

SetVipCache set vip to cache

func (*Dao) UpdateVipRecord

func (d *Dao) UpdateVipRecord(ctx context.Context, recordID, uid int64, info *model.VipInfo) (err error)

UpdateVipRecord update user vip record after buy success

Jump to

Keyboard shortcuts

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