database

package
v0.0.0-...-0ef8f77 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2022 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDB

func NewDB() (db *gorm.DB, err error)

Types

type AuthRepository

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

func NewAuthRepository

func NewAuthRepository(client *auth.Client) *AuthRepository

func (*AuthRepository) CreateCookie

func (r *AuthRepository) CreateCookie(token string, expires time.Duration) (string, error)

func (*AuthRepository) IsValid

func (r *AuthRepository) IsValid(token string) (bool, error)

func (*AuthRepository) IsValidCookie

func (r *AuthRepository) IsValidCookie(cookie string) (bool, error)

type OGPRepository

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

func NewOGPRepository

func NewOGPRepository() *OGPRepository

func (*OGPRepository) FindByURL

func (r *OGPRepository) FindByURL(url string) (*opengraph.OpenGraph, error)

func (*OGPRepository) Set

func (r *OGPRepository) Set(ogp *opengraph.OpenGraph)

type PostRepository

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

func NewPostRepository

func NewPostRepository(db *gorm.DB) *PostRepository

func (*PostRepository) Count

func (r *PostRepository) Count(condition string, params []interface{}) (count int, err error)

func (*PostRepository) Create

func (r *PostRepository) Create(post *entity.Post) error

func (*PostRepository) Delete

func (r *PostRepository) Delete(id string) error

func (*PostRepository) FindAll

func (r *PostRepository) FindAll(offset, pageSize int, condition string, params []interface{}, sortCondition string) (posts []*entity.Post, err error)

func (*PostRepository) FindByID

func (r *PostRepository) FindByID(id string) (*entity.Post, error)
func (r *PostRepository) FindByPermalink(permalink string) (*entity.Post, error)

func (*PostRepository) Update

func (r *PostRepository) Update(post *entity.Post) error

type PostsTagsRepository

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

func NewPostsTagsRepository

func NewPostsTagsRepository(db *gorm.DB) *PostsTagsRepository

func (*PostsTagsRepository) Delete

func (r *PostsTagsRepository) Delete(id string) error

func (*PostsTagsRepository) DeleteByPostID

func (r *PostsTagsRepository) DeleteByPostID(postID string) error

func (*PostsTagsRepository) FindByPostIDAndTagName

func (r *PostsTagsRepository) FindByPostIDAndTagName(postID, tagName string) (*entity.PostsTags, error)

func (*PostsTagsRepository) Store

func (r *PostsTagsRepository) Store(postsTags []*entity.PostsTags) error

type TagRepository

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

func NewTagRepository

func NewTagRepository(db *gorm.DB) *TagRepository

func (*TagRepository) Count

func (r *TagRepository) Count() (count int, err error)

func (*TagRepository) Delete

func (r *TagRepository) Delete(id string) error

func (*TagRepository) FindAll

func (r *TagRepository) FindAll(offset, pageSize int, condition string, params []interface{}) (tags []*entity.Tag, err error)

func (*TagRepository) FindByID

func (r *TagRepository) FindByID(id string) (*entity.Tag, error)

func (*TagRepository) FindByName

func (r *TagRepository) FindByName(name string) (*entity.Tag, error)

func (*TagRepository) Store

func (r *TagRepository) Store(tag *entity.Tag) error

Jump to

Keyboard shortcuts

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