Documentation ¶
Index ¶
Constants ¶
const ( // Builtin types (int, int8, string, bool, etc) Builtin = TypeCategory(iota + 1) // Simple types. eg: `type myInt int` Simple // Slice types. eg: `type mySlice []int` Slice // Map types. eg: `type myMap map[keyType]valueType` Map // Struct types. eg: `type myStruct struct{}` Struct )
Variables ¶
var ( ServerProcedure = ProcedureType("string") ClientProcedure = ProcedureType("client") )
ProcedureType's
var ( TypeInt = &Type{Name: "int", Category: Builtin} TypeInt8 = &Type{Name: "int8", Category: Builtin} TypeInt16 = &Type{Name: "int16", Category: Builtin} TypeInt32 = &Type{Name: "int32", Category: Builtin} TypeInt64 = &Type{Name: "int64", Category: Builtin} TypeUint = &Type{Name: "uint", Category: Builtin} TypeUint8 = &Type{Name: "uint8", Category: Builtin} TypeUint16 = &Type{Name: "uint16", Category: Builtin} TypeUint32 = &Type{Name: "uint32", Category: Builtin} TypeUint64 = &Type{Name: "uint64", Category: Builtin} TypeString = &Type{Name: "string", Category: Builtin} TypeBool = &Type{Name: "bool", Category: Builtin} BuiltinTypes = map[string]*Type{ TypeInt.Name: TypeInt, TypeInt8.Name: TypeInt8, TypeInt16.Name: TypeInt16, TypeInt32.Name: TypeInt32, TypeInt64.Name: TypeInt64, TypeUint.Name: TypeUint, TypeUint8.Name: TypeUint8, TypeUint16.Name: TypeUint16, TypeUint32.Name: TypeUint32, TypeUint64.Name: TypeUint64, TypeString.Name: TypeString, TypeBool.Name: TypeBool, } )
Builtin types
Functions ¶
This section is empty.
Types ¶
type Param ¶
Param defines an argument or return parameter
func (*Param) CapitalizedName ¶
CapitalizedName returns the name for this param, capitalized
func (*Param) IsNumber ¶
TODO: move method to (t *Type) IsNumber returns true when the type is numeric
func (*Param) JsTypeName ¶
TODO: move method to (t *Type) JsTypeName returns the Js TypeName for the Type
type Params ¶
type Params []*Param
Params is a list of parameters
func (Params) GoParameterList ¶
GoParameterList returns the params as go ParameterList (http://golang.org/ref/spec#ParameterList)
func (Params) JsParameterList ¶
JsParameterList returns a comma seperated string of arguments (name only)
type Procedure ¶
type Procedure struct { Type ProcedureType Oneway bool Name string Args Params Rets Params Source Source }
Procedure defines a remote method/function
func (*Procedure) CapitalizedName ¶
CapitalizedName returns the name, capitalized. Used by ango-service.tmpl.go
func (*Procedure) GoArgs ¶
GoArgs returns the go function definition argument ParameterList Used by ango-service.tmpl.go
func (*Procedure) GoCallArgs ¶
GoCallArgs returns the procedure call argument values Used by ango-service.tmpl.go
func (*Procedure) GoCallRets ¶
GoCallRets returns the procedure call return values Used by ango-service.tmpl.go
func (*Procedure) GoRets ¶
GoRets returns the go function definition return ParameterList Used by ango-service.tmpl.go
func (*Procedure) JsCallArgs ¶
JsCallArgs returns the procedure call argument values Used by ango-service.tmpl.js
type ProcedureType ¶
type ProcedureType string
ProcedureType indicates wether a procedure is server- or client-side
type Service ¶
type Service struct { // Name is the name given to the service Name string // Types defined on the service Types map[string]*Type // ServiceProceduers holds all server-side procedures, by their name ServerProcedures map[string]*Procedure // ClientProcedures holds all client-side procedures, by their name ClientProcedures map[string]*Procedure }
Service holds information about a ango service
func NewService ¶
func NewService() *Service
NewService creates a new service instance and sets up maps and defaults
func (*Service) CapitalizedName ¶
CapitalizedName returns the service name, capitalized. Used by ango-service.tmpl.go
func (*Service) JsClientProceduresStringAry ¶
JsClientProceduresStringAry returns a comma seperated list of js strings Used by ango-service.tmpl.js
func (*Service) LookupType ¶
LookupType searches for a type in the service.Types map or BuiltinTypes map. When a type is builtin and is not in service.Types yet, it is added. When a type cannot be found, nil is returned.
type Source ¶
type Source struct {
Linenumber int
}
Source contains information about where a given definition was declared.
type StructField ¶
StructField defines a single field in a struct
type Type ¶
type Type struct { // Name is the identifier of the type Name string // Category indicates the Type's category (builtin, simple, slice, map, struct) Category TypeCategory // SimpleType defines the type for the type that this type maps to SimpleType *Type // SliceElementType defines the type for the slice elements SliceElementType *Type // MapKeyType and MapValueType define the key and value types for the map MapKeyType *Type MapValueType *Type // StructFields holds the struct field definitions, only used when Category is Struct. StructFields []StructField }
Type is the type of a parameter It's value should be a valid go TypeName (http://golang.org/ref/spec#TypeName)
func (*Type) CapitalizedName ¶
CapitalizedName returns the name, capitalized
func (*Type) GoIsBuiltin ¶
GoIsBuiltin returns true when the type is a Go builtin type
func (*Type) GoName ¶
GoName returns the Go identifier for this type. The Go identifier is capitalized when the type is not a builtin Go type.
func (*Type) GoTypeDefinition ¶
type TypeCategory ¶
type TypeCategory int
TypeCategory is the category to which a type belongs. The different categories are defined as constants.