data

package
v0.0.0-...-c2164b1 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2023 License: MIT Imports: 19 Imported by: 0

README

Data

Documentation

Index

Constants

This section is empty.

Variables

ProviderSet is data providers.

Functions

func NewArticleRepo

func NewArticleRepo(data *Data, logger log.Logger) biz.ArticleRepo

NewArticleRepo .

func NewMysql

func NewMysql(c *conf.Data_Mysql) (db *gorm.DB, err error)

func NewRedis

func NewRedis(ctx context.Context, data *conf.Data_Redis) (client *redis.Client, err error)

func RecordNotFound

func RecordNotFound(db *gorm.DB) (ret bool)

RecordNotFound First、Last、Take 这些预期会返回结果的方法查询记录时,才会返回 ErrRecordNotFound

Types

type Article

type Article struct {
	Id         int64                 `gorm:"column:id;primaryKey;type:bigint;index;comment:id" json:"id"`
	Uid        int64                 `gorm:"column:uid;index;type:bigint;index;comment:user_id" json:"uid"`
	Title      string                `gorm:"column:title;type:varchar(32);comment:标题" json:"title"`
	Content    string                `gorm:"column:content;type:text;comment:博客内容" json:"content"`
	CreateTime int64                 `gorm:"column:create_time;type:bigint;not null" json:"create_time"`
	UpdateTime int64                 `gorm:"column:update_time;type:bigint;not null" json:"update_time"`
	DeleteTime soft_delete.DeletedAt `gorm:"column:delete_time;type:bigint;default:0;comment:删除时间" json:"-"`
}

func (*Article) BeforeCreate

func (a *Article) BeforeCreate(tx *gorm.DB) error

func (*Article) BeforeUpdate

func (a *Article) BeforeUpdate(tx *gorm.DB) error

type Data

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

Data .

func NewData

func NewData(c *conf.Data, logger log.Logger) (*Data, func(), error)

NewData .

Jump to

Keyboard shortcuts

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