models

package
v0.0.0-...-5569277 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Article

type Article struct {
	ID        primitive.ObjectID `bson:"_id" json:"id"`
	Author    string             `bson:"author" json:"author"`
	Title     string             `bson:"title" json:"title"`
	CreatedAt primitive.DateTime `bson:"created_at" json:"created_at"`
	UpdatedAt primitive.DateTime `bson:"updated_at" json:"updated_at"`
	Content   string             `bson:"content" json:"content"`
}

func (*Article) ConvertArticleID

func (a *Article) ConvertArticleID(id string) error

func (*Article) GenerateUpdatedAtTime

func (a *Article) GenerateUpdatedAtTime()

GenerateUpdatedAtTime generates the updated timestamp for the article

func (*Article) InitArticle

func (a *Article) InitArticle()

InitArticle initializes article id, created_at and updated_at fields for mongodb

type Config

type Config config.Config

type CreateArticlesReq

type CreateArticlesReq struct {
	Author  string `param:"author" json:"-"`
	Title   string `json:"title"`
	Content string `json:"content"`
}

type DeleteArticlesReq

type DeleteArticlesReq struct {
	ID     string `param:"id" json:"-"`
	Author string `param:"author" json:"-"`
}

type ErrorResp

type ErrorResp struct {
	Code    string `json:"code"`
	Message string `json:"message"`
}

type GetArticlesReq

type GetArticlesReq struct {
	ID     string `query:"id"`
	Author string `param:"author"`
	Page   int64  `query:"page"`
	Limit  int64  `query:"limit"`
}

func (*GetArticlesReq) CheckPaginationValue

func (ga *GetArticlesReq) CheckPaginationValue()

type GetArticlesResp

type GetArticlesResp struct {
	Articles []Article `json:"articles,omitempty"`
	Total    int64     `json:"total"`
}

type ModifyArticlesReq

type ModifyArticlesReq struct {
	ID      string `param:"id" json:"-"`
	Author  string `param:"author" json:"-"`
	Title   string `json:"title"`
	Content string `json:"content"`
}

Jump to

Keyboard shortcuts

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