rest

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2017 License: GPL-3.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendQueryString

func AppendQueryString(base, query string) string

AppendQueryString adds a field to a query string.

Types

type Link struct {
	Rel     string   `json:"-" xml:"rel,attr"`
	Href    string   `json:"href" xml:"href,attr"`
	Method  string   `json:"method,omitempty" xml:"method,attr,omitempty"`
	XMLName struct{} `json:"-" xml:"link"`
}

Link is a hypermedia/hyperdata related link.

type Links map[string]Link

Links represents a collection of Links on an entity.

func (Links) Add

func (l Links) Add(link Link)

Add a Link to this collection of Links.

func (Links) Canonical

func (l Links) Canonical(uri string)

Canonical creates a canonical link.

func (Links) CollectionCR

func (l Links) CollectionCR(base string, curPage page.Page, canWrite bool)

CollectionCR creates the collection create and retrieve links.

func (Links) Create

func (l Links) Create(uri string)

Create creates a create link. Create create.

func (Links) Delete

func (l Links) Delete(uri string)

Delete creates a delete link.

func (Links) Edit

func (l Links) Edit(uri string)

Edit creates an edit link.

func (Links) MarshalXML

func (l Links) MarshalXML(e *xml.Encoder, start xml.StartElement) error

MarshalXML fulfills xml.Marshaler

func (Links) Next

func (l Links) Next(base string, curPage page.Page)

Next creates a next page link.

func (Links) Previous

func (l Links) Previous(base string, curPage page.Page)

Previous creates a previous page link.

func (Links) RecordRUD

func (l Links) RecordRUD(uri string, canWrite bool)

RecordRUD creates the record retrieve, update, and delete links.

func (Links) Save

func (l Links) Save(uri string)

Save creates a save link.

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server handles HTTP requests.

func NewServer

func NewServer(conf config.Config) (*Server, error)

NewServer creates a new HTTP Server with the given configuration.

func (*Server) ServeHTTP

func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP fulfills http.Handler.

func (*Server) Start

func (s *Server) Start()

Start the server (HTTP and HTTPS, if configured)

func (*Server) Stop

func (s *Server) Stop()

Stop the server, allowing requests in flight to finish first.

Jump to

Keyboard shortcuts

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