server

package
v0.0.0-...-da20d80 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2016 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Modules []*Module

Functions

func BindRPCParams

func BindRPCParams(c *gin.Context, data interface{})

BindParams binds the RPC parameters to the given data object.

func Execute

func Execute(uid int64, params CallParams) (res interface{}, rError error)

Execute executes a method on an object

func GetFieldValue

func GetFieldValue(uid, id int64, model, field string) (res interface{}, rError error)

GetFieldValue retrieves the given field of the given model and id.

func LoadInternalResources

func LoadInternalResources()

LoadInternalResources loads all data in the 'views' directory, that are - views, - actions, - menu items,

func PostInit

func PostInit()

PostInit runs all actions that need to be done after all modules have been loaded. This is typically all actions that need to be done after bootstrapping the models. This function: - loads the data from the data files of all modules, - runs successively all PostInit() func of all modules, - loads html templates from all modules.

func RPC

func RPC(c *gin.Context, code int, obj interface{}, err ...error)

RPC serializes the given struct as JSON-RPC into the response body.

func RegisterModule

func RegisterModule(mod *Module)

RegisterModules registers the given module in the server This function should be called in the init() function of all YEP Addons.

Types

type CallParams

type CallParams struct {
	Model  string                     `json:"model"`
	Method string                     `json:"method"`
	Args   []json.RawMessage          `json:"args"`
	KWArgs map[string]json.RawMessage `json:"kwargs"`
}

type JSONRPCError

type JSONRPCError struct {
	Code    int         `json:"code"`
	Message string      `json:"message"`
	Data    interface{} `json:"data"`
}

type Module

type Module struct {
	Name     string
	PostInit func()
}

type RequestRPC

type RequestRPC struct {
	JsonRPC string          `json:"jsonrpc"`
	ID      int64           `json:"id"`
	Method  string          `json:"method"`
	Params  json.RawMessage `json:"params"`
}

type ResponseError

type ResponseError struct {
	JsonRPC string       `json:"jsonrpc"`
	ID      int64        `json:"id"`
	Error   JSONRPCError `json:"error"`
}

type ResponseRPC

type ResponseRPC struct {
	JsonRPC string      `json:"jsonrpc"`
	ID      int64       `json:"id"`
	Result  interface{} `json:"result"`
}

type SearchReadParams

type SearchReadParams struct {
	Context tools.Context `json:"context"`
	Domain  models.Domain `json:"domain"`
	Fields  []string      `json:"fields"`
	Limit   interface{}   `json:"limit"`
	Model   string        `json:"model"`
	Offset  int           `json:"offset"`
	Sort    string        `json:"sort"`
}

type SearchReadResult

type SearchReadResult struct {
	Records []models.FieldMap `json:"records"`
	Length  int               `json:"length"`
}

func SearchRead

func SearchRead(uid int64, params SearchReadParams) (res *SearchReadResult, rError error)

SearchRead retrieves database records according to the filters defined in params.

type Server

type Server struct {
	*gin.Engine
}

func GetServer

func GetServer() *Server

GetServer return the http server instance

Jump to

Keyboard shortcuts

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