post

package
v0.0.0-...-aa5fa10 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TablePost = "post"
)

Const

Variables

This section is empty.

Functions

func DeletePost

func DeletePost(id int64) (int64, error)

DeletePost delete Post

func GetTotalPost

func GetTotalPost() (int64, error)

GetTotalPost get total post https://pkg.go.dev/go.mongodb.org/mongo-driver/mongo#pkg-examples

func InsertPost

func InsertPost(post Post) error

InsertPost Insert Post

func UpdatePost

func UpdatePost(post Post) (int64, error)

UpdatePost update Post

Types

type Post

type Post struct {
	// ID        primitive.ObjectID `bson:"_id" json:"id"`
	ID        int64     `bson:"_id" json:"id"`
	Title     string    `bson:"title" json:"title"`
	Body      string    `bson:"body" json:"body"`
	CreatedAt time.Time `bson:"created_at" json:"-"`
	UpdatedAt time.Time `bson:"updated_at" json:"updatedAt"`
}

Post struct

func GetAllPost

func GetAllPost() []Post

GetAllPost get all post

func GetSlidePost

func GetSlidePost(skip int64, limlit int64) []Post

GetSlidePost get slide post

Jump to

Keyboard shortcuts

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