resource

package
v2.5.5+incompatible Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2021 License: MIT Imports: 7 Imported by: 2 modules, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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