webdb

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2018 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewRouter

func NewRouter(dummyService *Service) http.Handler

Types

type Config

type Config struct {
	Port      int
	Datastore *dsc.Config
}

Config representa an application config

func NewConfig

func NewConfig(port int, config *dsc.Config) *Config

NewConfig creates a new app config

func NewConfigFromURL

func NewConfigFromURL(URL string) (*Config, error)

NewConfig creates a new app config from supplied URL

type Dummy

type Dummy struct {
	Id     int        `column:"id" primaryKey:"true" autoincrement:"true" `
	Name   string     `column:"name"`
	TypeId *int       `column:"type_id" json:",omitempty"`
	Type   *DummyType `transient:"true"`
}

Dummy represents a dummy object

type DummyType

type DummyType struct {
	Id   int `primaryKey:"true"`
	Name string
}

DummyType represents a dummy type object

type FindRequest

type FindRequest struct {
	Id int
}

type FindResponse

type FindResponse struct {
	*Response
	Data *Dummy
}

type GetRequest

type GetRequest struct {
	Id int
}

type GetResponse

type GetResponse struct {
	*Response
	Data []*Dummy
}

type GetTypeRequest

type GetTypeRequest struct {
	Id int
}

type GetTypeResponse

type GetTypeResponse struct {
	*Response
	Data []*DummyType
}

type PersistRequest

type PersistRequest struct {
	Data *Dummy
}

type PersistResponse

type PersistResponse struct {
	*Response
	Data *Dummy
}

type Response

type Response struct {
	Status     string
	Error      string
	StatusCode *int `json:"-"`
}

func NewResponse

func NewResponse() *Response

func (*Response) GetStatusCode

func (r *Response) GetStatusCode() int

func (*Response) SetError

func (r *Response) SetError(err error)

type Router

type Router struct {
	*http.ServeMux
	// contains filtered or unexported fields
}

type Server

type Server struct {
	*http.Server
	// contains filtered or unexported fields
}

func NewServer

func NewServer(service *Service, port int) *Server

NewServer creates a new server

func (*Server) Stop

func (s *Server) Stop()

func (*Server) StopOnSiginals

func (s *Server) StopOnSiginals(siginals ...os.Signal)

type Service

type Service struct {
	dsc.Manager
	DbConfig *dsc.Config
}

Service represents application service

func New

func New(config *dsc.Config) (*Service, error)

New creates a new service

func (*Service) Find

func (s *Service) Find(request *FindRequest) *FindResponse

Find returns data for supplied id

func (*Service) GetAll

func (s *Service) GetAll(request *GetRequest) *GetResponse

GetAll returns all dummy

func (*Service) GetAllTypes

func (s *Service) GetAllTypes(request *GetTypeRequest) *GetTypeResponse

GetAll returns all dummy types

func (*Service) Handle

func (s *Service) Handle(request *http.Request, writer http.ResponseWriter)

Handle handles request

func (*Service) Persist

func (s *Service) Persist(request *PersistRequest) *PersistResponse

Persist persist supplied data

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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