Documentation ¶
Index ¶
- func HasPattern(attrs map[string]*sysl.Attribute, pattern string) bool
- func IsPrimitive(typeName string) bool
- func MakeApp(name string, params []*sysl.Param, types map[string]*sysl.Type) *sysl.Application
- func MakeAppName(name string) *sysl.AppName
- func MakeEnum(enum map[int64]string) *sysl.Type
- func MakeList(listType *sysl.Type) *sysl.Type
- func MakeMap(keyType *sysl.Type, valueType *sysl.Type) *sysl.Type
- func MakeNoType() *sysl.Type
- func MakeOneOf(oneOfType []*sysl.Type) *sysl.Type
- func MakeParam(name string, paramType *sysl.Type) *sysl.Param
- func MakePrimitive(primType string) *sysl.Type
- func MakeRelation(types map[string]*sysl.Type, primaryKey string, keys []string) *sysl.Type
- func MakeReturnStatement(payload string) *sysl.Statement
- func MakeSequence(seqType *sysl.Type) *sysl.Type
- func MakeSet(setType *sysl.Type) *sysl.Type
- func MakeTuple(tuple map[string]*sysl.Type) *sysl.Type
- func MakeType(name string, value interface{}, t string) *sysl.Type
- func MakeTypeRef(contextApp string, contextTypePath []string, refApp string, ...) *sysl.Type
- func ParamIn(attrs map[string]*sysl.Attribute) string
- type App
- type AppMapper
- func (am *AppMapper) BuildApplication(a *sysl.Application) *App
- func (am *AppMapper) ConvertTypes() map[string]*Type
- func (am *AppMapper) GetAttribute(attribute map[string]*sysl.Attribute, attributeName string) string
- func (am *AppMapper) GetRefDetails(t *sysl.Type) (appName string, typeName string)
- func (am *AppMapper) IndexTypes() map[string]*sysl.Type
- func (am *AppMapper) Map() (map[string]*App, error)
- func (am *AppMapper) MapSyslType(t *sysl.Type) (*sysl.Type, error)
- func (am *AppMapper) MapType(t *sysl.Type) *Type
- func (am *AppMapper) ResolveTypes()
- type Endpoint
- type Parameter
- type Type
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsPrimitive ¶ added in v0.97.0
IsPrimitive takes an input type string and returns true if the string is a builtin sysl primitive type. This includes double, int64, float64, string, bool, date, datetime Mostly used for parsing return statements
func MakeAppName ¶
func MakeNoType ¶
func MakePrimitive ¶
func MakeRelation ¶ added in v0.77.0
TODO relation, set, sequence, notype
func MakeReturnStatement ¶
Types ¶
type App ¶
type App struct { Name string Attributes map[string]string // Contains app level attributes. All attributes assumed to be strings. Endpoints map[string]*Endpoint // Contains all application endpoints Types map[string]*Type // Contains all type definitions in the application, excluding types defined in Params and Responses }
App is a simplified representation of an application in sysl
type AppMapper ¶
type AppMapper struct { Module *sysl.Module Types map[string]*sysl.Type // A map of all sysl types. Key is in format "appname:typename". SimpleTypes map[string]*Type // A map of all simplified types. Key is in format "appname:typename". }
func MakeAppMapper ¶
MakeAppMapper creates an appmapper
func (*AppMapper) BuildApplication ¶
func (am *AppMapper) BuildApplication(a *sysl.Application) *App
BuildApplication returns a clean representation of a Sysl Application which hides the complexities of the protobuf generated type.
func (*AppMapper) ConvertTypes ¶
func (*AppMapper) GetAttribute ¶
func (*AppMapper) GetRefDetails ¶
TypeRefs can have various formats. Case 1: When a type defined in the same app is referenced in a TYPE
- no appname is provided in the path
- the ref.path[0] element is the type name
Case 2: When a type from another app is referenced in a TYPE
- context is provided
- the ref.path[0] element is the application name
Case 3: When a type from another app is referenced in a parameter
- context is NOT provided
- ref.appName is provided
- the ref.path[0] element is the type name
Case 4: When a type from the same app is referenced in a parameter
- context is NOT provided
- ref.appName is provided AND is the type name (This is crazy and needs to be fixed)
func (*AppMapper) IndexTypes ¶
Creates a map of all types TODO Check if colon is valid in typename
func (*AppMapper) Map ¶
ImportModule takes a sysl module and maps them into an array of simplified App structs It resolves any type references and cross application calls
func (*AppMapper) MapSyslType ¶
MapSyslType converts types from sysl.Type to Type
func (*AppMapper) ResolveTypes ¶
func (am *AppMapper) ResolveTypes()
Iterates over types and resolves typerefs
type Endpoint ¶
type Endpoint struct { Summary string // Short human-readable description of what the endpoint does Description string // Longer description of what the endpoint does Path string // Path Params map[string]*Parameter // Request parameters Response map[string]*Parameter // Response parameters Downstream []string // TODO: Work out the dependency graph of each application. Store downstreams in this field. }
Endpoint is a simplified representation of a Sysl endpoint
type Type ¶
type Type struct { Description string PrimaryKey string // Used to represent the primary key for type relation and key for map types. Optional bool // Used to represent if the type is optional Reference string // Used to represent type references. In the format of app:typename. Type string // Used to indicate the type. Can be one of {"bool", "int", "float", "decimal", "string", "string_8", "bytes", "date", "datetime", "xml", "uuid", "ref", "list", "map", "enum", "tuple", relation} Items []*Type // Used to represent map types, where the 0 index is the key type, and 1 index is the value type. Enum map[int64]string // Used to represent enums Properties map[string]*Type // Used to represent tuple and relation types. }
Type represents a simplified Sysl Type.