logic

package
v0.0.0-...-ae1670a Latest Latest
Warning

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

Go to latest
Published: May 19, 2017 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const ERROR_UNKNOWN = 0xff00

Variables

View Source
var ErrmsgKeys = []string{"output", "errmsg"}
View Source
var ErrnoKeys = []string{"output", "errno"}
View Source
var InputKeys = []string{"input"}
View Source
var ObjectKeys = []string{"object"}
View Source
var OutputKeys = []string{"output"}
View Source
var ResultKeys = []string{"result"}
View Source
var ViewKeys = []string{"view"}

Functions

func Exec

func Exec(a app.IApp, program IProgram, ctx IContext) error

func GetFileContent

func GetFileContent(path string) (string, error)

func LuaToValue

func LuaToValue(L *lua.State, i int) interface{}

Types

type Context

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

func (*Context) Begin

func (C *Context) Begin()

func (*Context) End

func (C *Context) End()

func (*Context) Get

func (C *Context) Get(keys []string) interface{}

func (*Context) ReflectValue

func (C *Context) ReflectValue(value interface{}) interface{}

func (*Context) Set

func (C *Context) Set(keys []string, value interface{})

type IContext

type IContext interface {
	Begin()
	End()
	Set(keys []string, value interface{})
	Get(keys []string) interface{}
	ReflectValue(value interface{}) interface{}
}

type ILogic

type ILogic interface {
	Exec(a app.IApp, program IProgram, ctx IContext) error
}

type IProgram

type IProgram interface {
	GetLogic(name string) ILogic
}

type LuaContext

type LuaContext struct {
	Context
	L *lua.State
}

func NewLuaContext

func NewLuaContext() *LuaContext

func (*LuaContext) Close

func (L *LuaContext) Close()

func (*LuaContext) ReflectValue

func (C *LuaContext) ReflectValue(value interface{}) interface{}

type LuaViewLogic

type LuaViewLogic struct {
	ViewLogic
}

func (*LuaViewLogic) Exec

func (L *LuaViewLogic) Exec(a app.IApp, program IProgram, ctx IContext) error

type OutputField

type OutputField struct {
	Name  string
	Value interface{}
	Done  ILogic
}

type OutputLogic

type OutputLogic struct {
	Keys   string
	Value  interface{}
	Fields []OutputField
	Done   ILogic
}

func (*OutputLogic) Exec

func (L *OutputLogic) Exec(a app.IApp, program IProgram, ctx IContext) error

type Program

type Program struct {
}

func (*Program) GetLogic

func (P *Program) GetLogic(name string) ILogic

type RequestLogic

type RequestLogic struct {
	Name    string
	Options map[string]interface{}
	Timeout int64
	Fail    ILogic
	Done    ILogic
}

func (*RequestLogic) Exec

func (L *RequestLogic) Exec(a app.IApp, program IProgram, ctx IContext) error

type TaskLogic

type TaskLogic struct {
	Name    string
	Options map[string]interface{}
	Fail    ILogic
	Done    ILogic
}

func (*TaskLogic) Exec

func (L *TaskLogic) Exec(a app.IApp, program IProgram, ctx IContext) error

type VarLogic

type VarLogic struct {
	Keys  string
	Value interface{}
	Done  ILogic
}

func (*VarLogic) Exec

func (L *VarLogic) Exec(a app.IApp, program IProgram, ctx IContext) error

type VerifyLogic

type VerifyLogic struct {
	Value  interface{}
	Errno  interface{}
	Errmsg interface{}
	Fail   ILogic
	Done   ILogic
}

func (*VerifyLogic) Exec

func (L *VerifyLogic) Exec(a app.IApp, program IProgram, ctx IContext) error

type View

type View struct {
	Content     []byte
	ContentType string
}

type ViewLogic

type ViewLogic struct {
	Path        string
	ContentType string
	Fail        ILogic
	// contains filtered or unexported fields
}

func (*ViewLogic) Exec

func (L *ViewLogic) Exec(a app.IApp, program IProgram, ctx IContext) error

func (*ViewLogic) ExecCode

func (L *ViewLogic) ExecCode(a app.IApp, program IProgram, ctx IContext, code func(code string) string) error

type YamlProgram

type YamlProgram struct {
	Program
	// contains filtered or unexported fields
}

func NewYamlProgram

func NewYamlProgram(path string) (*YamlProgram, error)

func (*YamlProgram) GetLogic

func (P *YamlProgram) GetLogic(name string) ILogic

func (*YamlProgram) Use

func (P *YamlProgram) Use(name string, logic ILogic)

Jump to

Keyboard shortcuts

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