note

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type INote

type INote interface {
	GetPage(ctx context.Context, param PageParam) (r PageResult, err error)
	Get(ctx context.Context, id int) (r Result, err error)
	AddOne(ctx context.Context) (id int, err error)
	Mod(ctx context.Context, id int, p Param) (err error)
	Del(ctx context.Context, id int) (err error)
	Publish(ctx context.Context, id int) error
	Hide(ctx context.Context, id int) error
}

func New

func New(
	nm note.Noter,
) INote

type ModParam

type ModParam struct {
	NoteID int `json:"noteID"` // 记录ID
	Param
}

ModParam 修改参数

func (ModParam) Check

func (m ModParam) Check(ctx context.Context) error

Check 检查

type PageParam

type PageParam struct {
	Title  string `json:"title"`  // 标题
	Detail string `json:"detail"` // 详情

	app.CommonParam
}

PageParam 分页参数

type PageResult

type PageResult struct {
	Total int      `json:"total"` // 总数
	List  []Result `json:"list"`  // 列表
}

PageResult 分页结果

type Param

type Param struct {
	Title  string `json:"title"`  // 标题
	Detail string `json:"detail"` // 详情
}

Param 参数

func (Param) Check

func (p Param) Check(ctx context.Context) error

Check 检查

type Result

type Result struct {
	NoteID    int    `json:"noteID"`    // 笔记ID
	UserName  string `json:"userName"`  // 用户名
	Title     string `json:"title"`     // 标题
	Detail    string `json:"detail"`    // 详情
	CreatedAt int64  `json:"createdAt"` // 创建时间
}

Result 结果

func (Result) Init

func (r Result) Init(single note.Entity) (Result, error)

Init 初始化

Jump to

Keyboard shortcuts

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