po

package
v0.2.1-beta Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloseRelated

func CloseRelated()

CloseRelated 关闭全局预加载

func CommentMgr

func CommentMgr(db *gorm.DB) *_CommentMgr

CommentMgr open func

func OpenRelated

func OpenRelated()

OpenRelated 打开全局预加载

func PostMgr

func PostMgr(db *gorm.DB) *_PostMgr

PostMgr open func

Types

type Comment

type Comment struct {
	ID         int64     `gorm:"primaryKey;column:id;type:bigint;not null"`                // 评论自增 ID
	PostID     int64     `gorm:"index:idx_fk_post_id;column:post_id;type:bigint;not null"` // 文本自增 ID
	Post       Post      `gorm:"joinForeignKey:post_id;foreignKey:id"`
	Content    string    `gorm:"column:content;type:text;not null"`         // 评论内容
	Nickname   string    `gorm:"column:nickname;type:varchar(20);not null"` // 评论人昵称
	CreateTime time.Time `gorm:"column:create_time;type:timestamp"`         // 创建时间
	UpdateTime time.Time `gorm:"column:update_time;type:timestamp"`         // 更新时间
}

Comment [...]

func (*Comment) ConvertFromDTO

func (po *Comment) ConvertFromDTO(dto *core.CommentInfo, postId int64, password string) error

type Comments

type Comments []*Comment

func (Comments) ConvertToDTO

func (po Comments) ConvertToDTO(password string) ([]*core.CommentInfo, error)

type Condetion

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

自定义sql查询

func (*Condetion) And

func (c *Condetion) And(column string, cases string, value ...interface{})

And a condition by and .and 一个条件

func (*Condetion) Get

func (c *Condetion) Get() (where string, out []interface{})

func (*Condetion) Or

func (c *Condetion) Or(column string, cases string, value ...interface{})

Or a condition by or .or 一个条件

type Option

type Option interface {
	// contains filtered or unexported methods
}

Option overrides behavior of Connect.

type Post

type Post struct {
	ID           int64     `gorm:"primaryKey;column:id;type:bigint;not null"`               // 文本自增 ID
	Content      string    `gorm:"column:content;type:text;not null"`                       // 文本内容
	Lang         int16     `gorm:"column:lang;type:smallint;not null;default:0"`            // 文本语言
	Passwd       string    `gorm:"column:passwd;type:varchar(255)"`                         // 密码
	Nickname     string    `gorm:"column:nickname;type:varchar(20);not null"`               // 文本作者昵称
	IsDisposable bool      `gorm:"column:is_disposable;type:tinyint(1);not null;default:0"` // 是否阅后即焚
	CreateTime   time.Time `gorm:"column:create_time;type:timestamp"`                       // 创建时间
	UpdateTime   time.Time `gorm:"column:update_time;type:timestamp"`                       // 更新时间
}

Post [...]

func (*Post) ConvertFromDTO

func (po *Post) ConvertFromDTO(dto *core.PostInfo, password string) error

func (*Post) ConvertToDTO

func (po *Post) ConvertToDTO(password string) (*core.PostInfo, error)

Jump to

Keyboard shortcuts

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