Documentation ¶
Index ¶
- type Action
- type BytesReader
- func (r *BytesReader) Buffered() int
- func (r *BytesReader) Bytes() []byte
- func (r *BytesReader) Discard(n int) (int, error)
- func (r *BytesReader) Read(b []byte) (n int, err error)
- func (r *BytesReader) ReadByte() (byte, error)
- func (r *BytesReader) ReadBytes(fn func(byte) bool) ([]byte, error)
- func (r *BytesReader) ReadFull() ([]byte, error)
- func (r *BytesReader) ReadFullTemp() ([]byte, error)
- func (r *BytesReader) ReadN(n int) ([]byte, error)
- func (r *BytesReader) ReadSlice(delim byte) ([]byte, error)
- func (r *BytesReader) Reset(b []byte)
- func (r *BytesReader) UnreadByte() error
- type Config
- func (c *Config) AddResource(resource *Resource)
- func (c *Config) DB() *pg.DB
- func (c *Config) DefaultAccept() string
- func (c *Config) DefaultContentType() string
- func (c *Config) ErrorLogger() *log.Logger
- func (c *Config) GetResource(resourceName string) *Resource
- func (c *Config) InfoLogger() *log.Logger
- func (c *Config) Prefix() string
- func (c *Config) SetDefaultAccept(defaultAccept string)
- func (c *Config) SetDefaultContentType(defaultContentType string)
- func (c *Config) SetErrorLogger(logger *log.Logger)
- func (c *Config) SetInfoLogger(logger *log.Logger)
- func (c *Config) SetPrefix(prefix string)
- func (c *Config) String() string
- type Engine
- type Error
- type Executor
- func (e *Executor) DeleteExecFunc() transactional.ExecFunc
- func (e *Executor) ExecuteWithSearchPath(ctx context.Context, searchPath string, execFunc transactional.ExecFunc) error
- func (e *Executor) GetOneExecFunc() transactional.ExecFunc
- func (e *Executor) GetSearchPath(ctx context.Context) (string, error)
- func (e *Executor) GetSliceExecFunc() transactional.ExecFunc
- func (e *Executor) InsertExecFunc() transactional.ExecFunc
- func (e *Executor) UpdateExecFunc() transactional.ExecFunc
- type Field
- type Filter
- type Op
- type Page
- type Relation
- type Resource
- type RestQuery
- type Server
- type Sort
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BytesReader ¶
type BytesReader struct {
// contains filtered or unexported fields
}
BytesReader is reader implementation
func NewBytesReader ¶
func NewBytesReader(b []byte) *BytesReader
NewBytesReader creates new instance
func (*BytesReader) ReadBytes ¶
func (r *BytesReader) ReadBytes(fn func(byte) bool) ([]byte, error)
ReadBytes reads bytes
func (*BytesReader) ReadFullTemp ¶
func (r *BytesReader) ReadFullTemp() ([]byte, error)
ReadFullTemp reads full temp
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
Config structure
func (*Config) AddResource ¶
AddResource adds resource
func (*Config) DefaultAccept ¶
DefaultAccept gets defaultAccept
func (*Config) DefaultContentType ¶
DefaultContentType gets defaultContentType
func (*Config) ErrorLogger ¶
ErrorLogger gets error logger
func (*Config) GetResource ¶
GetResource gets resource
func (*Config) SetDefaultAccept ¶
SetDefaultAccept sets defaultAccept
func (*Config) SetDefaultContentType ¶
SetDefaultContentType sets defaultContentType
func (*Config) SetErrorLogger ¶
SetErrorLogger sets error logger
func (*Config) SetInfoLogger ¶
SetInfoLogger sets info logger
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
Engine structure
func (*Engine) Deserialize ¶
Deserialize deserializes data into entity
type Error ¶
Error struct
func NewErrorBadRequest ¶
NewErrorBadRequest constructs Error with bad request code
func NewErrorForbbiden ¶
NewErrorForbbiden constructs Error with forbidden code
func NewErrorFromCause ¶
NewErrorFromCause constructs Error from cause error
type Executor ¶
type Executor struct {
// contains filtered or unexported fields
}
Executor structure
func NewExecutor ¶
NewExecutor constructs Executor
func (*Executor) DeleteExecFunc ¶
func (e *Executor) DeleteExecFunc() transactional.ExecFunc
DeleteExecFunc deletes execution function
func (*Executor) ExecuteWithSearchPath ¶
func (e *Executor) ExecuteWithSearchPath(ctx context.Context, searchPath string, execFunc transactional.ExecFunc) error
ExecuteWithSearchPath executes with search path
func (*Executor) GetOneExecFunc ¶
func (e *Executor) GetOneExecFunc() transactional.ExecFunc
GetOneExecFunc gets one execution function
func (*Executor) GetSearchPath ¶
GetSearchPath gets search path
func (*Executor) GetSliceExecFunc ¶
func (e *Executor) GetSliceExecFunc() transactional.ExecFunc
GetSliceExecFunc gets slice execution function
func (*Executor) InsertExecFunc ¶
func (e *Executor) InsertExecFunc() transactional.ExecFunc
InsertExecFunc inserts execution function
func (*Executor) UpdateExecFunc ¶
func (e *Executor) UpdateExecFunc() transactional.ExecFunc
UpdateExecFunc updates execution function
type Filter ¶
type Filter struct { Op Op // operation Attr string // attribute name Value interface{} // attribute value Filters []*Filter // sub filters for 'and' and 'or' operations }
Filter structure
type Op ¶
type Op string
Op operation filter type
const ( // And operation for group And Op = "and" // Or operation for group Or Op = "or" // Eq operation for attribute (? = ?) Eq Op = "eq" // Neq operation for attribute (? != ?) Neq Op = "neq" // In operation for attribute (? IN ?) In Op = "in" // Nin operation for attribute (? NOT IN ?) Nin Op = "nin" // Gt operation for attribute (? > ?) Gt Op = "gt" // Gte operation for attribute (? >= ?) Gte Op = "gte" // Lt operation for attribute (? < ?) Lt Op = "lt" // Lte operation for attribute (? <= ?) Lte Op = "lte" // Lk operation for attribute (? LIKE ?) Lk Op = "lk" // Nlk operation for attribute (? NOT LIKE ?) Nlk Op = "nlk" // Ilk operation for attribute (? ILIKE ?) Ilk Op = "ilk" // Nilk operation for attribute (? NOT ILIKE ?) Nilk Op = "nilk" // Sim operation for attribute (? SIMILAR TO ?) Sim Op = "sim" // Nsim operation for attribute (? NOT SIMILAR TO ?) Nsim Op = "nsim" // Ilkua operation for attribute (? ILIKE ? WITH UNACCENT) Ilkua Op = "ilkua" // Nilkua operation for attribute (? NOT ILIKE ? WITH UNACCENT) Nilkua Op = "nilkua" // Null operation for attribute (? IS NULL) Null Op = "null" // Nnull operation for attribute (? IS NOT NULL) Nnull Op = "nnull" )
type Page ¶
type Page struct { Slice interface{} `json:"slice"` Offset int `json:"offset"` Limit int `json:"limit"` Count int `json:"count"` }
Page structure
type Resource ¶
type Resource struct {
// contains filtered or unexported fields
}
Resource structure
func NewResource ¶
NewResource constructs Resource
func (*Resource) ResourceType ¶
ResourceType returns resourceType
type RestQuery ¶
type RestQuery struct { Request *http.Request Action Action Resource string Key string ContentType string Accept string Content []byte Offset int Limit int Fields []*Field Relations []*Relation Sorts []*Sort Filter *Filter SearchPath string Debug bool }
RestQuery structure
func RequestDecoder ¶
RequestDecoder decodes rest parameters from request
type Server ¶
type Server struct { Engine // contains filtered or unexported fields }
Server structure
func (*Server) ServeHTTP ¶
func (s *Server) ServeHTTP(writer http.ResponseWriter, request *http.Request)
ServeHTTP serves rest request
func (*Server) SetNextHandler ¶
SetNextHandler sets next handler for middleware use