rest

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2018 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ThematicResolver = "thematic"
	RuledResolver    = "ruled"
	SimpleResolver   = "simple"
)

Names for the different resolver types.

Variables

This section is empty.

Functions

func DecodeQuery

func DecodeQuery(vals url.Values, out interface{}) error

DecodeQuery decodes a query into the given struct. It can only be used to decode bool, int, float32, float64 and string values or slices of one of these types. All other typed fields of the given struct are ignored.

func EncodeQuery

func EncodeQuery(in interface{}) (string, error)

EncodeQuery encodes a query using the given struct. It can only encode bool, int, float32, float64 and string values or slices of one of these types. All other typed fields in the struct are ignored.

func WithGet

func WithGet(f http.HandlerFunc) http.HandlerFunc

WithGet wraps a HandlerFunc and checks if the request method is GET. If not, an error is logged and the handler function is not called.

func WithGetOrPost

func WithGetOrPost(f http.HandlerFunc) http.HandlerFunc

WithGetOrPost wraps a HandlerFunc and checks if the request method is GET or POST. If not, an error is logged and the handler function is not called.

func WithLogging

func WithLogging(f http.HandlerFunc) http.HandlerFunc

WithLogging wraps a HandlerFunc and logs the handling of the request.

func WithPost

func WithPost(f http.HandlerFunc) http.HandlerFunc

WithPost wraps a HandlerFunc and checks if the request method is POST. If not, an error is logged and the handler function is not called.

Types

type ConceptInfo

type ConceptInfo struct {
	Concept *semix.Concept
	Entries []string
}

ConceptInfo holds information about a concept.

func (ConceptInfo) Predicates

func (info ConceptInfo) Predicates() map[*semix.Concept][]*semix.Concept

Predicates returns a map of the targets ordered by the predicates.

type Context

type Context struct {
	Before, Match, After, URL string
	Begin, End, Len           int
}

Context specifies the context of a match

type DumpFileContent

type DumpFileContent struct {
	ContentType, Content, Path string
}

DumpFileContent defines the content and the content type of a dump file.

type PutData

type PutData struct {
	URL         string
	Local       bool
	Errors      []int
	Resolvers   []Resolver
	ContentType string
	Content     string
}

PutData defines the data that is send to the server's put method

type Resolver

type Resolver struct {
	Name       string
	Threshold  float64
	MemorySize int
}

Resolver defines one of the three resolvers simple, automatic or ruled as defined in bitbucket.org/fflo/semix/pkg/resolve

func MakeResolvers

func MakeResolvers(t float64, m int, rs []string) ([]Resolver, error)

MakeResolvers is a simple helper function to build resolvers from a list of strings.

type Server

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

Server represents a server instance.

func New

func New(self, dir string, r *semix.Resource, i index.Interface) (*Server, error)

New returns a new server instance.

func (*Server) Close

func (s *Server) Close() error

Close closes the server and its enclosed index.

func (*Server) ListenAndServe

func (s *Server) ListenAndServe() error

ListenAndServe starts the server.

Jump to

Keyboard shortcuts

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