post

package
v0.0.0-...-5e9aa0f Latest Latest
Warning

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

Go to latest
Published: May 7, 2020 License: BSD-3-Clause Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

This section is empty.

Types

type Form

type Form struct {
	Title           string `json:"title"`
	Content         string `json:"content"`
	MarkdownContent string `json:"markdown_content"`
	State           int    `json:"state"`
}

func (*Form) Validate

func (f *Form) Validate() error

type Post

type Post struct {
	oldmodels.Post
	MarkdownContent string `json:"markdown_content"`
}

type QueryParams

type QueryParams struct {
	api.QueryParams
	Title string `json:"title"`
	State string `json:"state"`
}

func (QueryParams) Validate

func (qp QueryParams) Validate() error

type Resource

type Resource struct {
	*api.Application
	// contains filtered or unexported fields
}

func New

func New(app *api.Application, service Service) *Resource

func (*Resource) RegisterRoutes

func (r *Resource) RegisterRoutes(router clevergo.IRouter)

type Service

type Service interface {
	Get(id int64) (*Post, error)
	Create(*clevergo.Context) (*Post, error)
	Count() (uint64, error)
	Query(limit, offset uint64, qps *QueryParams) ([]oldmodels.Post, error)
	Update(id int64, form *Form) (*Post, error)
	Delete(id int64) error
}

func NewService

func NewService(db *sqlex.DB, userManager *api.UserManager) Service

Jump to

Keyboard shortcuts

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