mysql_db

package
v1.0.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetNewOauthDb

func GetNewOauthDb(config *MysqlDbConfig) db_base.OauthDbInterface

Types

type MysqlDbConfig

type MysqlDbConfig struct {
	User         string
	Password     string
	Addr         string
	Port         int64
	DatabaseName string
}

type OAuthDao

type OAuthDao struct {
	Config MysqlDbConfig
	Engine *xorm.Engine
}

func (*OAuthDao) DeleteExpireTokens

func (d *OAuthDao) DeleteExpireTokens(ctx context.Context) error

func (*OAuthDao) DeleteOauthToken

func (d *OAuthDao) DeleteOauthToken(ctx context.Context, token string) error

func (*OAuthDao) DeletePartner

func (d *OAuthDao) DeletePartner(ctx context.Context, partnerKey string) error

func (*OAuthDao) GenOauthToken

func (d *OAuthDao) GenOauthToken(ctx context.Context, partnerKey string) (*db_base.OauthToken, error)

#TODO: add rate limit #TODO: add redis cache for partner info #TODO: add local cache for partner info

func (*OAuthDao) GenPartner

func (d *OAuthDao) GenPartner(ctx context.Context, partnerName string, expire int64) (*db_base.Partner, error)

func (*OAuthDao) GetPartnerByKey

func (d *OAuthDao) GetPartnerByKey(ctx context.Context, partnerKey string) (*db_base.Partner, error)

func (*OAuthDao) GetTokenInfo

func (d *OAuthDao) GetTokenInfo(ctx context.Context, token string) (*db_base.OauthToken, error)

func (*OAuthDao) Init

func (d *OAuthDao) Init(config *MysqlDbConfig) error

type PartnerTab

type PartnerTab struct {
	Id              int64  `xorm:"pk autoincr BIGINT(20)"`
	PartnerName     string `xorm:"VARCHAR(64)"`
	PartnerKey      string `xorm:"unique VARCHAR(64)"`
	PartnerSecret   string `xorm:"VARCHAR(64)"`
	Expire          int64  `xorm:"default 3600 BIGINT(20)"`
	CreateTimestamp int64  `xorm:"BIGINT(20)"`
	UpdateTimestamp int64  `xorm:"BIGINT(20)"`
}

type TokenTab

type TokenTab struct {
	Id              int64  `xorm:"pk autoincr BIGINT(20)"`
	PartnerKey      string `xorm:"index(pratner_token_index) VARCHAR(64)"`
	Token           string `xorm:"index(pratner_token_index) unique VARCHAR(128)"`
	Expire          int64  `xorm:"BIGINT(20)"`
	ExpireTimestamp int64  `xorm:"BIGINT(20)"`
	CreateTimestamp int64  `xorm:"BIGINT(20)"`
	UpdateTimestamp int64  `xorm:"BIGINT(20)"`
}

Jump to

Keyboard shortcuts

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