dao

package
v0.0.0-...-e68aaec Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitTable

func InitTable(db *egorm.Component) error

Types

type Article

type Article struct {
	Id int64 `gorm:"primaryKey;autoIncrement"`
	// 对应作者
	Uid      int64  `gorm:"index"`
	Title    string `gorm:"not null"`
	Content  string `gorm:"type:text"`
	Abstract string `gorm:"type:text"`
	// 存储为毫秒时间戳
	Ctime int64 `gorm:"autoCreateTime:milli"`       // 自动创建时间,单位为毫秒
	Utime int64 `gorm:"autoUpdateTime:milli;index"` // 自动更新时间,单位为毫秒
}

Article 制作库

func (Article) TableName

func (Article) TableName() string

TableName 设置表名

type ArticleDao

type ArticleDao interface {
	Create(ctx context.Context, art Article) (int64, error)
	Update(ctx context.Context, art Article) error
	Count(ctx context.Context, uid int64) (int64, error)
	List(ctx context.Context, offset int, limit int, uid int64) ([]Article, error)
	Sync(ctx context.Context, art Article) (int64, error)
	PublishTotal(ctx context.Context) (int64, error)
	PubList(ctx context.Context, offset int, limit int) ([]PublishArticle, error)
	GetArtById(ctx context.Context, aid int64) (Article, error)
	GetPubArtById(ctx context.Context, aid int64) (PublishArticle, error)
	DeleteById(ctx context.Context, aid int64) error
}

func NewArticleGormDao

func NewArticleGormDao(db *egorm.Component) ArticleDao

type ArticleGormDao

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

func (*ArticleGormDao) Count

func (dao *ArticleGormDao) Count(ctx context.Context, uid int64) (int64, error)

func (*ArticleGormDao) Create

func (dao *ArticleGormDao) Create(ctx context.Context, art Article) (int64, error)

func (*ArticleGormDao) DeleteById

func (dao *ArticleGormDao) DeleteById(ctx context.Context, aid int64) error

func (*ArticleGormDao) GetArtById

func (dao *ArticleGormDao) GetArtById(ctx context.Context, aid int64) (Article, error)

func (*ArticleGormDao) GetPubArtById

func (dao *ArticleGormDao) GetPubArtById(ctx context.Context, aid int64) (PublishArticle, error)

func (*ArticleGormDao) List

func (dao *ArticleGormDao) List(ctx context.Context,
	offset int, limit int, uid int64) ([]Article, error)

func (*ArticleGormDao) PubList

func (dao *ArticleGormDao) PubList(ctx context.Context, offset int, limit int) ([]PublishArticle, error)

func (*ArticleGormDao) PublishTotal

func (dao *ArticleGormDao) PublishTotal(ctx context.Context) (int64, error)

func (*ArticleGormDao) Sync

func (dao *ArticleGormDao) Sync(ctx context.Context, art Article) (int64, error)

func (*ArticleGormDao) Update

func (dao *ArticleGormDao) Update(ctx context.Context, art Article) error

type PublishArticle

type PublishArticle Article

func (PublishArticle) TableName

func (PublishArticle) TableName() string

Jump to

Keyboard shortcuts

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