api

package
v0.0.0-...-7c2803f Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PostAPI

type PostAPI struct {
	DB PostDatabase
}

The PostAPI provides handlers for managing posts.

func (*PostAPI) CreatePost

func (a *PostAPI) CreatePost(ctx *gin.Context)

CreatePost creates a post.

func (*PostAPI) DeletePostByID

func (a *PostAPI) DeletePostByID(ctx *gin.Context)

DeletePostByID deletes the post by id

func (*PostAPI) GetPostByID

func (a *PostAPI) GetPostByID(ctx *gin.Context)

GetPostByID returns the post by id

func (*PostAPI) GetPosts

func (a *PostAPI) GetPosts(ctx *gin.Context)

GetPosts returns all the posts _end=5&_order=DESC&_sort=id&_start=0 adapt react-admin

func (*PostAPI) UpdatePostByID

func (a *PostAPI) UpdatePostByID(ctx *gin.Context)

UpdatePostByID is

type PostDatabase

type PostDatabase interface {
	GetPosts(paging *model.Paging) []*model.Post
	GetPostByID(id primitive.ObjectID) *model.Post
	CreatePost(post *model.Post) *model.Post
	UpdatePost(post *model.Post) *model.Post
	DeletePostByID(id primitive.ObjectID) error
	CountPost(condition interface{}) string
}

The PostDatabase interface for encapsulating database access.

type UserAPI

type UserAPI struct {
	DB UserDatabase
}

The UserAPI provides handlers for managing users.

func (*UserAPI) DeleteUserByID

func (a *UserAPI) DeleteUserByID(ctx *gin.Context)

DeleteUserByID deletes the user by id

func (*UserAPI) GetUserByIDs

func (a *UserAPI) GetUserByIDs(ctx *gin.Context)

GetUserByIDs returns the user by id

func (*UserAPI) GetUsers

func (a *UserAPI) GetUsers(ctx *gin.Context)

GetUsers returns all the users _end=5&_order=DESC&_sort=id&_start=0 adapt react-admin

type UserDatabase

type UserDatabase interface {
	GetUserByIDs(ids []primitive.ObjectID) []*model.User
	DeleteUserByID(id primitive.ObjectID) error
	CreateUser(user *model.User) error
	GetUsers(paging *model.Paging) []*model.User
	CountUser() string
}

The UserDatabase interface for encapsulating database access.

Jump to

Keyboard shortcuts

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