rest

package module
v0.0.0-...-ba68c60 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2020 License: MIT Imports: 6 Imported by: 0

README

go-rest

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CollectionLink struct {
	ResourceName string
	Query        Query
}

func (*CollectionLink) Render

func (cl *CollectionLink) Render() string

type DBResource

type DBResource struct {
	IsNew        bool `json:"-"`
	Id           int64
	ResourceName string
	Payload      interface{}
}

func (DBResource) GetId

func (r DBResource) GetId() int64
func (r DBResource) GetLinks() LinkList

func (DBResource) GetPayload

func (r DBResource) GetPayload() interface{}

func (DBResource) GetResourceName

func (r DBResource) GetResourceName() string

func (DBResource) HasId

func (r DBResource) HasId() bool

type DBResourceDriver

type DBResourceDriver struct {
	Gw           tablegateway.AutomatableTableDataGateway
	ResourceName string
}

func (DBResourceDriver) Create

func (dbr DBResourceDriver) Create(data Resource) (int64, error)

func (DBResourceDriver) Delete

func (dbr DBResourceDriver) Delete(id int64) (int64, error)

func (DBResourceDriver) Find

func (dbr DBResourceDriver) Find(id int64) (res Resource, err error)

func (DBResourceDriver) NewResource

func (dbr DBResourceDriver) NewResource(payload interface{}) DBResource

func (DBResourceDriver) Query

func (dbr DBResourceDriver) Query(q Query) (ListResult, error)

func (DBResourceDriver) Update

func (dbr DBResourceDriver) Update(id int64, changes map[string]interface{}) (int64, error)
type Link interface {
	Render() string
}
type LinkList map[string]string

type ListResult

type ListResult struct {
	ResourceName string
	Query        Query
	List         []Resource
}

type Query

type Query struct {
	Filters map[string]interface{}
	Order   []string
	Offset  int
	Limit   int
}

func (*Query) Render

func (q *Query) Render() string

type Resource

type Resource interface {
	GetId() int64
	HasId() bool
	GetResourceName() string
	GetLinks() LinkList
	GetPayload() interface{}
}

type ResourceDriver

type ResourceDriver interface {
	Find(id int64) (Resource, error)
	Delete(id int64) error
	Create(data Resource) (int64, error)
	Update(id int64, changes map[string]interface{}) error
	Query(q Query) (ListResult, error)
}
type ResourceLink struct {
	ResourceName string
	Id           int
}

func (*ResourceLink) Render

func (rl *ResourceLink) Render() string

Jump to

Keyboard shortcuts

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