repositories

package
v0.0.0-...-c605425 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2020 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthRepository

type AuthRepository struct {
	Ctx *gin.Context
	// contains filtered or unexported fields
}

func (*AuthRepository) GitHubAccessURL

func (a *AuthRepository) GitHubAccessURL(uuid string) (url string)

func (*AuthRepository) GitHubExchangeTokenByCode

func (a *AuthRepository) GitHubExchangeTokenByCode(code string) (accessToken string, err error)

func (*AuthRepository) GithubUserBing

func (a *AuthRepository) GithubUserBing(sessionUser interface{}, githubUser *models.GithubUserInfo) (user *models.User, err error)

func (*AuthRepository) GithubUserCreate

func (a *AuthRepository) GithubUserCreate(github *models.GithubUserInfo) (user *models.User, err error)

通过github auth进行用户的创建

func (*AuthRepository) GithubUserInfoByAccessToken

func (a *AuthRepository) GithubUserInfoByAccessToken(token string) (*models.GithubUserInfo, error)

通过github获取用户信息

type CaptchaImageResponse

type CaptchaImageResponse struct {
	CaptchaId string `json:"captchaId"`
	ImageUrl  string `json:"imageUrl"`
}

type CaptchaRepository

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

func (*CaptchaRepository) GetCaptchaImage

func (c *CaptchaRepository) GetCaptchaImage(length int) CaptchaImageResponse

func (*CaptchaRepository) ServeHTTPCaptcha

func (c *CaptchaRepository) ServeHTTPCaptcha(id string, reload bool) (content bytes.Buffer, err error)

func (*CaptchaRepository) ServeImage

func (c *CaptchaRepository) ServeImage(id string, width, height int, reload bool) (content bytes.Buffer, err error)

func (*CaptchaRepository) VerifyCaptcha

func (c *CaptchaRepository) VerifyCaptcha(captchaId string, value string) (err error)

type CommentRepository

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

func (*CommentRepository) CountComment

func (c *CommentRepository) CountComment() int

func (*CommentRepository) ListCommentByPostID

func (c *CommentRepository) ListCommentByPostID(postId uint) ([]*models.Comment, error)

func (*CommentRepository) MustListUnreadComment

func (c *CommentRepository) MustListUnreadComment() ([]*models.Comment, error)

type IAuthRepository

type IAuthRepository interface {
	GitHubAccessURL(uuid string) (url string)
	GitHubExchangeTokenByCode(code string) (accessToken string, err error)
	GithubUserInfoByAccessToken(token string) (*models.GithubUserInfo, error)
	GithubUserCreate(github *models.GithubUserInfo) (*models.User, error)
	GithubUserBing(sessionUser interface{}, githubUser *models.GithubUserInfo) (user *models.User, err error)
}

func NewAuthRepository

func NewAuthRepository() IAuthRepository

type ICaptchaRepository

type ICaptchaRepository interface {
	GetCaptchaImage(length int) CaptchaImageResponse
	ServeHTTPCaptcha(id string, reload bool) (bytes.Buffer, error)
	ServeImage(id string, width, height int, reload bool) (content bytes.Buffer, err error)
	VerifyCaptcha(captchaId string, value string) (err error)
}

func NewCaptchaRepository

func NewCaptchaRepository(ctx *gin.Context) ICaptchaRepository

type ICommentRepository

type ICommentRepository interface {
	MustListUnreadComment() ([]*models.Comment, error)
	CountComment() int
	ListCommentByPostID(postId uint) ([]*models.Comment, error)
}

func NewCommentRepository

func NewCommentRepository() ICommentRepository

type ILinkRepository

type ILinkRepository interface {
	ListAllLink(columns []string) (links []*models.Link, err error)
	ListLink(per, page int, columns []string) (links []*models.Link, err error)
	Create() (link models.Link, err error)
	UpdateAttr() (models.Link, error)
	Update(link *models.Link) error
	Delete() (uint, error)
	Show() (link models.Link, err error)
	GetLinkById(id uint) (models.Link, error)
}

func NewLinkRepository

func NewLinkRepository(ctx *gin.Context) ILinkRepository

type IMailRepository

type IMailRepository interface {
	SendToMail(to string) error
	SystemDefaultNotify() error
	GetSystemNotify() string
}

func NewMailRepository

func NewMailRepository(subject, body, mailType string) IMailRepository

type IPageRepository

type IPageRepository interface {
	New() (models.Page, error)
	GinCreate() error
	GinUpdate(id uint) error
	Create(page models.Page) (models.Page, error)
	UpdateAttr(page *models.Page, attr map[string]interface{}) error
	Update(page *models.Page) error
	UpdatePage(page *models.Page) error
	Delete(id uint) error
	Publish(id uint) error
	FindPage(id uint) (models.Page, error)
	ListAllPage(attr map[string]interface{}) ([]*models.Page, error)
	ListPage(per, page uint, attr map[string]interface{}, columns []string) ([]*models.Page, error)
	PublishPage(per, page uint, attr map[string]interface{}, columns []string) (pages []*models.Page, err error)
	TotalPage(attr map[string]interface{}) (total int, err error)
}

func NewPageRepository

func NewPageRepository(ctx *gin.Context) IPageRepository

type IPostRepository

type IPostRepository interface {
	ListAll(attr map[string]interface{}, column []string) (posts []*models.Post, err error)
	Create(post *models.Post) error
	Delete(id uint) error
	UpdateAttr(post *models.Post, attr map[string]interface{}) error
	Update(post *models.Post) error
	GetPostById(id uint, isTags bool) (*models.Post, error)
	PublishPost(per, page uint, attr map[string]interface{}, columns []string, isTags bool) ([]*models.Post, error)
	CountPostByTag(tagId uint) (count int, err error)
	CountPost(attr map[string]interface{}) (count int, err error)
	ListMaxReadPost(column []string) ([]*models.Post, error)
	ListMaxCommentPost(columns []string) ([]*models.Post, error)
	TagsPost(per, page uint, attr map[string]interface{}, columns []string, tag string) (posts []*models.Post, err error)
}

func NewPostRepository

func NewPostRepository(ctx *gin.Context) IPostRepository

type ISubscriberRepository

type ISubscriberRepository interface {
	AllListSubscriber(attr map[string]interface{}, columns []string) ([]*models.Subscriber, error)
	ListSubscriber(per, page uint, attr map[string]interface{}, columns []string) ([]*models.Subscriber, error)
}

func NewSubscriberRepository

func NewSubscriberRepository(ctx *gin.Context) ISubscriberRepository

type ITagRepository

type ITagRepository interface {
	ListTagByPostId(id uint) (tags []*models.Tag, err error)
	DeletePostTagByPostId(postId uint) error
	Create(tag models.Tag) (models.Tag, error)
	PostTagCreate(tag *models.PostTag) error
	Delete(id uint) error
	AllTag(attr map[string]interface{}, columns []string) ([]models.Tag, error)
	PublishTagsList() ([]*models.Tag, error)
}

func NewTagRepository

func NewTagRepository(ctx *gin.Context) ITagRepository

type IUserRepository

type IUserRepository interface {
	Register() (err error)
	SignIn(account string, password string) (user *models.User, err error)
	FirstUser() (*models.User, error)
	GetUserByID(id int64) (*models.User, error)
	FirstUserByEmail(email string) (models.User, error)
	Update(user *models.User, attr map[string]interface{}) error
	UpdateUserAttr(attr map[string]interface{}) error
	ListAllAdminUsers(columns []string) ([]*models.User, error)
	ListAdminUsers(per, page int, columns []string) ([]*models.User, error)
	ReloadGithub(user *models.User) (err error)
	Lock(user *models.User) (err error)
	GetUser() (*models.User, error)
	SetUser(user *models.User) error
}

func NewUserRepository

func NewUserRepository(ctx *gin.Context) IUserRepository

type IValidatorRepository

type IValidatorRepository interface {
	HandlerError() error
}

func NewValidatorRepository

func NewValidatorRepository(model interface{}) IValidatorRepository

type LinkRepository

type LinkRepository struct {
	Ctx *gin.Context
	// contains filtered or unexported fields
}

func (*LinkRepository) Create

func (l *LinkRepository) Create() (link models.Link, err error)

创建链接

func (*LinkRepository) Delete

func (l *LinkRepository) Delete() (uint, error)

func (*LinkRepository) GetLinkById

func (l *LinkRepository) GetLinkById(id uint) (models.Link, error)
func (l *LinkRepository) ListAllLink(columns []string) (links []*models.Link, err error)

查询link没有进行分页

func (l *LinkRepository) ListLink(per, page int, columns []string) (links []*models.Link, err error)

查询link

func (*LinkRepository) Show

func (l *LinkRepository) Show() (link models.Link, err error)

func (*LinkRepository) Update

func (l *LinkRepository) Update(link *models.Link) error

func (*LinkRepository) UpdateAttr

func (l *LinkRepository) UpdateAttr() (link models.Link, err error)

更新link

type MailRepository

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

邮箱发送功能 @params to: 接受者邮箱 @params subject: 发送主体 @params body: 主体内容 @params mailType: 发送的内容

func (*MailRepository) GetSystemNotify

func (m *MailRepository) GetSystemNotify() string

func (*MailRepository) SendToMail

func (m *MailRepository) SendToMail(to string) error

func (*MailRepository) SystemDefaultNotify

func (m *MailRepository) SystemDefaultNotify() error

type PageRepository

type PageRepository struct {
	Ctx *gin.Context
	// contains filtered or unexported fields
}

func (*PageRepository) Create

func (p *PageRepository) Create(page models.Page) (models.Page, error)

func (*PageRepository) Delete

func (p *PageRepository) Delete(id uint) error

func (*PageRepository) FindPage

func (p *PageRepository) FindPage(id uint) (models.Page, error)

func (*PageRepository) GinCreate

func (p *PageRepository) GinCreate() (err error)

func (*PageRepository) GinUpdate

func (p *PageRepository) GinUpdate(id uint) error

func (*PageRepository) ListAllPage

func (p *PageRepository) ListAllPage(attr map[string]interface{}) ([]*models.Page, error)

func (*PageRepository) ListPage

func (p *PageRepository) ListPage(per, page uint, attr map[string]interface{}, columns []string) ([]*models.Page, error)

func (*PageRepository) New

func (p *PageRepository) New() (models.Page, error)

func (*PageRepository) Publish

func (p *PageRepository) Publish(id uint) error

func (*PageRepository) PublishPage

func (p *PageRepository) PublishPage(per, page uint, attr map[string]interface{}, columns []string) (pages []*models.Page, err error)

func (*PageRepository) TotalPage

func (p *PageRepository) TotalPage(attr map[string]interface{}) (total int, err error)

func (*PageRepository) Update

func (p *PageRepository) Update(page *models.Page) error

func (*PageRepository) UpdateAttr

func (p *PageRepository) UpdateAttr(page *models.Page, attr map[string]interface{}) error

func (*PageRepository) UpdatePage

func (p *PageRepository) UpdatePage(page *models.Page) error

type PostRepository

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

func (*PostRepository) CountPost

func (p *PostRepository) CountPost(attr map[string]interface{}) (count int, err error)

func (*PostRepository) CountPostByTag

func (p *PostRepository) CountPostByTag(tagId uint) (count int, err error)

func (*PostRepository) Create

func (p *PostRepository) Create(post *models.Post) error

func (*PostRepository) Delete

func (p *PostRepository) Delete(id uint) error

func (*PostRepository) GetPostById

func (p *PostRepository) GetPostById(id uint, isTags bool) (*models.Post, error)

func (PostRepository) ListAll

func (p PostRepository) ListAll(attr map[string]interface{}, column []string) (posts []*models.Post, err error)

@title: 获取所有的博客

func (*PostRepository) ListMaxCommentPost

func (p *PostRepository) ListMaxCommentPost(columns []string) ([]*models.Post, error)

func (*PostRepository) ListMaxReadPost

func (p *PostRepository) ListMaxReadPost(column []string) ([]*models.Post, error)

func (*PostRepository) PublishPost

func (p *PostRepository) PublishPost(per, page uint, attr map[string]interface{}, columns []string, isTag bool) ([]*models.Post, error)

func (*PostRepository) TagsPost

func (p *PostRepository) TagsPost(per, page uint, attr map[string]interface{}, columns []string, tag string) (posts []*models.Post, err error)

func (*PostRepository) Update

func (p *PostRepository) Update(post *models.Post) (err error)

func (*PostRepository) UpdateAttr

func (p *PostRepository) UpdateAttr(post *models.Post, attr map[string]interface{}) error

type SubscriberRepository

type SubscriberRepository struct {
	Ctx *gin.Context
	// contains filtered or unexported fields
}

func (SubscriberRepository) AllListSubscriber

func (s SubscriberRepository) AllListSubscriber(attr map[string]interface{}, columns []string) ([]*models.Subscriber, error)

func (SubscriberRepository) ListSubscriber

func (s SubscriberRepository) ListSubscriber(per, page uint, attr map[string]interface{}, columns []string) ([]*models.Subscriber, error)

type TagRepository

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

func (*TagRepository) AllTag

func (t *TagRepository) AllTag(attr map[string]interface{}, columns []string) ([]models.Tag, error)

func (*TagRepository) Create

func (t *TagRepository) Create(tag models.Tag) (models.Tag, error)

func (*TagRepository) Delete

func (t *TagRepository) Delete(id uint) error

func (*TagRepository) DeletePostTagByPostId

func (t *TagRepository) DeletePostTagByPostId(postId uint) error

func (TagRepository) ListTagByPostId

func (t TagRepository) ListTagByPostId(id uint) (tags []*models.Tag, err error)

func (*TagRepository) PostTagCreate

func (t *TagRepository) PostTagCreate(tag *models.PostTag) error

func (*TagRepository) PublishTagsList

func (t *TagRepository) PublishTagsList() ([]*models.Tag, error)

type UserRepository

type UserRepository struct {
	Ctx *gin.Context
	// contains filtered or unexported fields
}

func (*UserRepository) FirstUser

func (u *UserRepository) FirstUser() (user *models.User, err error)

func (*UserRepository) FirstUserByEmail

func (u *UserRepository) FirstUserByEmail(email string) (models.User, error)

func (*UserRepository) GetUser

func (u *UserRepository) GetUser() (user *models.User, err error)

func (*UserRepository) GetUserByID

func (u *UserRepository) GetUserByID(id int64) (user *models.User, err error)

func (*UserRepository) ListAdminUsers

func (u *UserRepository) ListAdminUsers(per, page int, columns []string) ([]*models.User, error)

func (*UserRepository) ListAllAdminUsers

func (u *UserRepository) ListAllAdminUsers(columns []string) ([]*models.User, error)

func (*UserRepository) Lock

func (u *UserRepository) Lock(user *models.User) error

func (*UserRepository) Register

func (u *UserRepository) Register() (err error)

系统后台进行注册

func (*UserRepository) ReloadGithub

func (u *UserRepository) ReloadGithub(user *models.User) (err error)

func (*UserRepository) SetUser

func (u *UserRepository) SetUser(user *models.User) error

func (*UserRepository) SignIn

func (u *UserRepository) SignIn(account string, password string) (*models.User, error)

用户进行登录

func (*UserRepository) Update

func (u *UserRepository) Update(user *models.User, attr map[string]interface{}) error

func (*UserRepository) UpdateUserAttr

func (u *UserRepository) UpdateUserAttr(attr map[string]interface{}) error

type ValidatorRepository

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

func (*ValidatorRepository) HandlerError

func (v *ValidatorRepository) HandlerError() error

handler validator error

Jump to

Keyboard shortcuts

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