models

package
v0.0.0-...-ad06c44 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2020 License: MIT Imports: 4 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Add

func Add(post *Post) (int64, error)

Add はデータベースに投稿を追加する

Types

type Post

type Post struct {
	ID        int64     `orm:"auto;column(id)"`
	Author    string    `orm:"size(128)"                    form:"author"   valid:"Required;MinSize(1);MaxSize(128)"`
	Body      string    `orm:"type(longtext)"               form:"body"     valid:"Required;MinSize(1);MaxSize(1024)"`
	CreatedAt time.Time `orm:"type(datetime);auto_now_add"`
	UpdatedAt time.Time `orm:"type(datetime);auto_now"`
}

func GetAll

func GetAll(limit int64, offset int64) (posts []Post, err error)

GetAll はすべての投稿を取得する limit は取得する投稿数の上限, -1 ならば制限なくすべての投稿を取得する offset は取得する投稿の位置

Jump to

Keyboard shortcuts

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