query

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2022 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Humanizer

type Humanizer interface {
	// Humanize returns a human readable representation of the supplied value.
	Humanize(interface{}) (string, error)
}

Humanizer takes an object in and returns out it's human readable representation.

func DefaultHumanizer

func DefaultHumanizer() Humanizer

DefaultHumanizer returns the JSON representation of val.

type HumanizerFunc

type HumanizerFunc func(interface{}) (string, error)

HumanizerFunc is an adapter to make conforming functions into Humanizers.

func (HumanizerFunc) Humanize

func (fn HumanizerFunc) Humanize(val interface{}) (string, error)

Humanize returns the human readable representation of val.

type Option

type Option func(s *Server)

Option is a function that applies a configuration to the server.

func WithHumanizer

func WithHumanizer(h Humanizer) Option

WithHumanizer sets the humanizer to use for the queried values. By default, the value will be printed out as JSON.

func WithLogger

func WithLogger(l goka.Logger) Option

WithLogger sets the logger to use. By default, it logs to the standard library logger.

type Server

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

Server is a provides HTTP routes for querying the group table.

func NewServer

func NewServer(basePath string, router *mux.Router, opts ...Option) *Server

NewServer creates a server with the given options.

func (*Server) AttachSource

func (s *Server) AttachSource(name string, getter goka.Getter) error

AttachSource attaches a new source to the query server.

func (*Server) BasePath

func (s *Server) BasePath() string

Jump to

Keyboard shortcuts

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