repository

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAccessTokenRepository

func NewAccessTokenRepository() domain.IAccessTokenRepository

func NewAccountRepository

func NewAccountRepository() domain.IAccountRepository

func NewCodeRepository

func NewCodeRepository() domain.ICodeRepository

func NewGithubRepository

func NewGithubRepository(options ...GithubOption) domain.IGithubRepository

func NewPrivateTelInfoRepository

func NewPrivateTelInfoRepository() domain.IPrivateTelInfoRepository

Types

type AccessTokenRepository

type AccessTokenRepository struct {
}

func (*AccessTokenRepository) DelAccessToken

func (atRepo *AccessTokenRepository) DelAccessToken(ctx context.Context, token string) error

func (*AccessTokenRepository) GetAccessToken

func (atRepo *AccessTokenRepository) GetAccessToken(ctx context.Context, token string) (int, error)

func (*AccessTokenRepository) SetAccessToken

func (atRepo *AccessTokenRepository) SetAccessToken(ctx context.Context, token string, id int) error

type AccountRepository

type AccountRepository struct {
}

func (*AccountRepository) DelByUserIdFromCache

func (ar *AccountRepository) DelByUserIdFromCache(ctx context.Context, userId int) error

func (*AccountRepository) DeleteFromCache

func (ar *AccountRepository) DeleteFromCache(ctx context.Context, openid string) error

func (*AccountRepository) GetByUserID

func (ar *AccountRepository) GetByUserID(ctx context.Context, userId int) ([]domain.Account, error)

func (*AccountRepository) GetOneByOpenid

func (ar *AccountRepository) GetOneByOpenid(ctx context.Context, openid string) (*domain.Account, error)

func (*AccountRepository) Save

func (ar *AccountRepository) Save(
	_ context.Context,
	account *domain.Account,
	privateTel *domain.PrivateTelInfo,
	privateInfo *domain.PrivateInfo,
	profile *domain.Profile,
	update func(account *domain.Account),
) error

func (*AccountRepository) SaveSns

func (ar *AccountRepository) SaveSns(ctx context.Context, account *domain.Account, profile *domain.Profile, unionid *domain.Unionid, update func(account *domain.Account)) error

type CodeRepository

type CodeRepository struct {
}

func (*CodeRepository) GetByTel

func (cr *CodeRepository) GetByTel(ctx context.Context, tel, nationCode string, purpose int) (*domain.Code, error)

func (*CodeRepository) GetByTelAndCode

func (cr *CodeRepository) GetByTelAndCode(ctx context.Context, tel, nationCode, code string, purpose int) (*domain.Code, error)

func (*CodeRepository) Save

func (cr *CodeRepository) Save(ctx context.Context, code *domain.Code) error

func (*CodeRepository) Update

func (cr *CodeRepository) Update(ctx context.Context, code *domain.Code) error

type GithubAccessTokenReq

type GithubAccessTokenReq struct {
	ClientId     string `json:"client_id"`
	ClientSecret string `json:"client_secret"`
	Code         string `json:"code"`
}

type GithubErrResp

type GithubErrResp struct {
	Error            string `json:"error"`
	ErrorDescription string `json:"error_description"`
	ErrorUri         string `json:"error_uri"`
}

type GithubOption

type GithubOption func(repo *GithubRepository)

func WithClientId

func WithClientId(clientId string) GithubOption

func WithClientSecret

func WithClientSecret(clientSecret string) GithubOption

type GithubRepository

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

func (*GithubRepository) GetAccessToken

func (r *GithubRepository) GetAccessToken(code string) (*domain.GithubAccessTokenResp, error)

func (*GithubRepository) UserInfo

func (r *GithubRepository) UserInfo(accessToken, openid string) (*domain.GithubUserInfoResp, error)

type GithubUserErrResp

type GithubUserErrResp struct {
	Message          string `json:"message"`
	DocumentationUrl string `json:"documentation_url"`
}

type GithubUserResp

type GithubUserResp struct {
	Login                   string `json:"login"`
	ID                      int64  `json:"id"`
	NodeID                  string `json:"node_id"`
	AvatarURL               string `json:"avatar_url"`
	GravatarID              string `json:"gravatar_id"`
	URL                     string `json:"url"`
	HTMLURL                 string `json:"html_url"`
	FollowersURL            string `json:"followers_url"`
	FollowingURL            string `json:"following_url"`
	GistsURL                string `json:"gists_url"`
	StarredURL              string `json:"starred_url"`
	SubscriptionsURL        string `json:"subscriptions_url"`
	OrganizationsURL        string `json:"organizations_url"`
	ReposURL                string `json:"repos_url"`
	EventsURL               string `json:"events_url"`
	ReceivedEventsURL       string `json:"received_events_url"`
	Type                    string `json:"type"`
	SiteAdmin               bool   `json:"site_admin"`
	Name                    string `json:"name"`
	Company                 string `json:"company"`
	Blog                    string `json:"blog"`
	Location                string `json:"location"`
	Email                   string `json:"email"`
	Hireable                string `json:"hireable"`
	Bio                     string `json:"bio"`
	TwitterUsername         string `json:"twitter_username"`
	PublicRepos             int64  `json:"public_repos"`
	PublicGists             int64  `json:"public_gists"`
	Followers               int64  `json:"followers"`
	Following               int64  `json:"following"`
	CreatedAt               string `json:"created_at"`
	UpdatedAt               string `json:"updated_at"`
	PrivateGists            int64  `json:"private_gists"`
	TotalPrivateRepos       int64  `json:"total_private_repos"`
	OwnedPrivateRepos       int64  `json:"owned_private_repos"`
	DiskUsage               int64  `json:"disk_usage"`
	Collaborators           int64  `json:"collaborators"`
	TwoFactorAuthentication bool   `json:"two_factor_authentication"`
	Plan                    Plan   `json:"plan"`
}

type Plan

type Plan struct {
	Name          string `json:"name"`
	Space         int64  `json:"space"`
	Collaborators int64  `json:"collaborators"`
	PrivateRepos  int64  `json:"private_repos"`
}

type PrivateTelInfoRepository

type PrivateTelInfoRepository struct {
}

func (*PrivateTelInfoRepository) DelByHashFromCache

func (pTr *PrivateTelInfoRepository) DelByHashFromCache(ctx context.Context, hash string) error

func (*PrivateTelInfoRepository) GetOneByHash

func (pTr *PrivateTelInfoRepository) GetOneByHash(ctx context.Context, hash string) (*domain.PrivateTelInfo, error)

Jump to

Keyboard shortcuts

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