go-hateoas: github.com/leoride/go-hateoas Index | Files

package hateoas

import "github.com/leoride/go-hateoas"

Index

Package Files

create.go delete.go get_all.go get_one.go hateoas.go types.go update.go util.go

func Handle Uses

func Handle(apiPath string, rh ResourceHandler) error

type Error Uses

type Error struct {
    Status           int    `json:"status"`
    Code             int    `json:"code"`
    Property         string `json:"property,omitempty"`
    Message          string `json:"message"`
    DeveloperMessage string `json:"developerMessage"`
    MoreInfo         string `json:"moreInfo,omitempty"`
}

This is a returned type Error type for REST hateoas

func (*Error) Error Uses

func (e *Error) Error() string

type Page Uses

type Page struct {
    Href     Url
    Offset   int
    Limit    int
    First    *Url
    Previous *Url
    Next     *Url
    Last     *Url
    Items    []hateoasResource

    TotalItems int
}

This is a returned type Page type for REST hateoas

type PageOpts Uses

type PageOpts struct {
    Offset int
    Limit  int
}

PageOpts type for page options extracted from the GET parameters

type Resource Uses

type Resource interface {
    GetId() string
}

Abstract interface for a REST resource

type ResourceHandler Uses

type ResourceHandler interface {
    ResourceName() string

    GetOne(string) (Resource, *Error)
    GetAll(PageOpts) ([]Resource, *Error)
    Create(Resource) (string, *Error)
    Update(string, Resource) (Resource, *Error)
    Delete(string) *Error

    Count() (int, *Error)
}

Abstract interface for a REST resource handler

type Url Uses

type Url string

URL type for representing HREF links

Package hateoas imports 6 packages (graph). Updated 2019-10-16. Refresh now. Tools for package owners.