resource

package
v0.0.0-...-95b4fb8 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2022 License: MIT Imports: 7 Imported by: 16

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChocolateResource

type ChocolateResource struct {
	ChocStorage *storage.ChocolateStorage
	UserStorage *storage.UserStorage
}

ChocolateResource for api2go routes

func (ChocolateResource) Create

func (c ChocolateResource) Create(obj interface{}, r api2go.Request) (api2go.Responder, error)

Create a new choc

func (ChocolateResource) Delete

Delete a choc :(

func (ChocolateResource) FindAll

FindAll chocolates

func (ChocolateResource) FindOne

FindOne choc

func (ChocolateResource) Update

func (c ChocolateResource) Update(obj interface{}, r api2go.Request) (api2go.Responder, error)

Update a choc

type Response

type Response struct {
	Res  interface{}
	Code int
}

The Response struct implements api2go.Responder

func (Response) Metadata

func (r Response) Metadata() map[string]interface{}

Metadata returns additional meta data

func (Response) Result

func (r Response) Result() interface{}

Result returns the actual payload

func (Response) StatusCode

func (r Response) StatusCode() int

StatusCode sets the return status code

type UserResource

type UserResource struct {
	ChocStorage *storage.ChocolateStorage
	UserStorage *storage.UserStorage
}

UserResource for api2go routes

func (UserResource) Create

func (s UserResource) Create(obj interface{}, r api2go.Request) (api2go.Responder, error)

Create method to satisfy `api2go.DataSource` interface

func (UserResource) Delete

func (s UserResource) Delete(id string, r api2go.Request) (api2go.Responder, error)

Delete to satisfy `api2go.DataSource` interface

func (UserResource) FindAll

func (s UserResource) FindAll(r api2go.Request) (api2go.Responder, error)

FindAll to satisfy api2go data source interface

func (UserResource) FindOne

func (s UserResource) FindOne(ID string, r api2go.Request) (api2go.Responder, error)

FindOne to satisfy `api2go.DataSource` interface this method should return the user with the given ID, otherwise an error

func (UserResource) PaginatedFindAll

func (s UserResource) PaginatedFindAll(r api2go.Request) (uint, api2go.Responder, error)

PaginatedFindAll can be used to load users in chunks

func (UserResource) Update

func (s UserResource) Update(obj interface{}, r api2go.Request) (api2go.Responder, error)

Update stores all changes on the user

Jump to

Keyboard shortcuts

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