presenter

package
v0.0.0-...-3a6a5bb Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2021 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	NotUnsignedIntegerErr = errors.New("Not unisgned integer")
	NotIntegerErr         = errors.New("Not integer")
	NotFloatErr           = errors.New("Not float")
)

Functions

func GetValue

func GetValue(value *querykit.Value) interface{}

Types

type Condition

type Condition struct {
	Name       string       `json:"name"`
	Field      string       `json:"field"`
	Value      interface{}  `json:"value"`
	Operator   string       `json:"operator"`
	Conditions []*Condition `json:"conditions"`
	Runtime    *goja.Runtime
}

func NewCondition

func NewCondition() *Condition

func (*Condition) InitRuntime

func (condition *Condition) InitRuntime()

type Endpoint

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

func NewEndpoint

func NewEndpoint(presenter *Presenter, name string) *Endpoint

func (*Endpoint) InitStates

func (endpoint *Endpoint) InitStates() error

func (*Endpoint) Load

func (endpoint *Endpoint) Load(filename string) error

func (*Endpoint) Register

func (endpoint *Endpoint) Register() error

type EndpointConfig

type EndpointConfig struct {
	Method   string         `json:"method"`
	Uri      string         `json:"uri"`
	Query    QueryConfig    `json:"query"`
	Response ResponseConfig `json:"response"`
}

type Pagination

type Pagination struct {
	Limit   interface{} `json:"limit"`
	Page    interface{} `json:"page"`
	Runtime *goja.Runtime
}

func New

func New() *Pagination

func (*Pagination) InitRuntime

func (pagination *Pagination) InitRuntime()

type Param

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

type Presenter

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

func NewPresenter

func NewPresenter(server http_server.Server) *Presenter

func (*Presenter) Init

func (presenter *Presenter) Init() error

type QueryAdapter

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

func NewQueryAdapter

func NewQueryAdapter() *QueryAdapter

func (*QueryAdapter) Init

func (adapter *QueryAdapter) Init() error

func (*QueryAdapter) Query

func (adapter *QueryAdapter) Query(table string, condition *Condition, option *QueryOption) (*querykit.QueryReply, error)

type QueryConfig

type QueryConfig struct {
	Condition  *Condition  `json:"condition"`
	Pagination *Pagination `json:"pagination"`
	Table      string      `json:"table"`
	Limit      int64       `json:"limit"`
	Offset     int64       `json:"offset"`
	OrderBy    string      `json:"orderBy"`
	Descending bool        `json:"descending"`
}

type QueryOption

type QueryOption struct {
	Limit      int64
	Offset     int64
	OrderBy    string
	Descending bool
}

type ResponseConfig

type ResponseConfig struct {
	ContentType string                     `json:"contentType"`
	State       map[string]StateDefinition `json:"state"`
}

type StateDefinition

type StateDefinition struct {
	ContentType string `json:"contentType"`
	Code        int    `json:"code"`
	Template    string `json:"template"`
	// contains filtered or unexported fields
}

type VariableType

type VariableType int
const (
	VARIABLE_TYPE_PARAMS VariableType = iota
	VARIABLE_TYPE_QUERYSTRING
	VARIABLE_TYPE_BODY
)

type ViewData

type ViewData struct {
	Records []map[string]interface{}
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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