Documentation ¶
Index ¶
- func GetNewOauthDb(config *MysqlDbConfig) db_base.OauthDbInterface
- type MysqlDbConfig
- type OAuthDao
- func (d *OAuthDao) DeleteExpireTokens(ctx context.Context) error
- func (d *OAuthDao) DeleteOauthToken(ctx context.Context, token string) error
- func (d *OAuthDao) DeletePartner(ctx context.Context, partnerKey string) error
- func (d *OAuthDao) GenOauthToken(ctx context.Context, partnerKey string) (*db_base.OauthToken, error)
- func (d *OAuthDao) GenPartner(ctx context.Context, partnerName string, expire int64) (*db_base.Partner, error)
- func (d *OAuthDao) GetPartnerByKey(ctx context.Context, partnerKey string) (*db_base.Partner, error)
- func (d *OAuthDao) GetTokenInfo(ctx context.Context, token string) (*db_base.OauthToken, error)
- func (d *OAuthDao) Init(config *MysqlDbConfig) error
- type PartnerTab
- type TokenTab
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetNewOauthDb ¶
func GetNewOauthDb(config *MysqlDbConfig) db_base.OauthDbInterface
Types ¶
type MysqlDbConfig ¶
type OAuthDao ¶
type OAuthDao struct { Config MysqlDbConfig Engine *xorm.Engine }
func (*OAuthDao) DeleteExpireTokens ¶
func (*OAuthDao) DeleteOauthToken ¶
func (*OAuthDao) DeletePartner ¶
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 (*OAuthDao) GetPartnerByKey ¶
func (*OAuthDao) GetTokenInfo ¶
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)"` }
Click to show internal directories.
Click to hide internal directories.