Documentation ¶
Index ¶
- Constants
- Variables
- func AddFuncOnReceiver(def *Statement, receiver, typeName, funcName string) *Statement
- func AddMarshalJSON(def *Statement, receiver, typeName string, f func(def *Group)) *Statement
- func AddRestLiDecode(def *Statement, receiver, typeName string, f func(def *Group)) *Statement
- func AddRestLiEncode(def *Statement, receiver, typeName string, f func(def *Group)) *Statement
- func AddStringer(def *Statement, receiver, typeName string, f func(def *Group)) *Statement
- func AddUnmarshalJSON(def *Statement, receiver, typeName string, f func(def *Group)) *Statement
- func AddWordWrappedComment(code *Statement, comment string) *Statement
- func Bytes() *Statement
- func ExportedIdentifier(identifier string) string
- func FqcpToPackagePath(fqcp string) string
- func GenerateAllImportsFile(outputDir string, codeFiles []*CodeFile) error
- func GenerateCode(specBytes []byte, outputDir string) error
- func IfErrReturn(def *Group, results ...Code) *Group
- func JsonFieldTag(name string, optional bool) map[string]string
- func PrivateIdentifier(identifier string) string
- func ReceiverName(typeName string) string
- func RestLiMethod(method protocol.RestLiMethod) *Statement
- func WriteJenFile(filename string, file *File) error
- type CodeFile
- type ComplexType
- type Enum
- type Field
- type FinderParams
- type Fixed
- type GoRestliSpec
- type Identifier
- type IdentifierSet
- type Method
- type MethodType
- type NamedType
- type Path
- type PathKey
- type PrimitiveType
- type Record
- type Resource
- func (r *Resource) GenerateActionCode(a *Method) *CodeFile
- func (r *Resource) GenerateCode() []*CodeFile
- func (r *Resource) GenerateFinderCode(f *Method) *CodeFile
- func (r *Resource) GenerateRestMethodCode(m *Method) *Statement
- func (r *Resource) NewCodeFile(filename string) *CodeFile
- func (r *Resource) PackagePath() string
- type RestliType
- func (t *RestliType) GoType() *Statement
- func (t *RestliType) InnerTypes() IdentifierSet
- func (t *RestliType) IsMapOrArray() bool
- func (t *RestliType) IsUnion() bool
- func (t *RestliType) PointerType() *Statement
- func (t *RestliType) ReferencedType() *Statement
- func (t *RestliType) RestLiEncodeModel(encoder string, accessor *Statement) (*Statement, bool)
- func (t *RestliType) RestLiReducedEncodeModel(accessor *Statement) (def *Statement, hasError bool)
- func (t *RestliType) RestLiURLEncodeModel(accessor *Statement) (def *Statement, hasError bool)
- func (t *RestliType) UnmarshalJSON(data []byte) error
- func (t *RestliType) WriteToBuf(def *Group, accessor *Statement)
- type Typeref
- type UnionMember
- type UnionType
Constants ¶
View Source
const ( EncodingJson = "encoding/json" Unmarshal = "Unmarshal" UnmarshalJSON = "UnmarshalJSON" Marshal = "Marshal" MarshalJSON = "MarshalJSON" Codec = "codec" RestLiEncode = "RestLiEncode" RestLiDecode = "RestLiDecode" RestLiCodec = "RestLiCodec" RestLiUrlEncoder = "RestLiUrlEncoder" RestLiReducedEncoder = "RestLiReducedEncoder" PopulateDefaultValues = "populateDefaultValues" ValidateUnionFields = "validateUnionFields" NetHttp = "net/http" ProtocolPackage = "github.com/bored-engineer/go-restli/protocol" )
View Source
const ( RestLiClient = "RestLiClient" FormatQueryUrl = "FormatQueryUrl" ResourcePath = "ResourcePath" ResourceEntityPath = "ResourceEntityPath" DoAndIgnore = "DoAndIgnore" DoAndDecode = "DoAndDecode" DoAndDecodeResult = "doAndDecodeResult" FindBy = "FindBy" ReqVar = "req" ResVar = "res" UrlVar = "url" PathVar = "path" PatchVar = "patch" ClientReceiver = "c" ClientType = "client" ClientInterfaceType = "Client" )
View Source
const CreateParam = "create"
View Source
const EncodeFinderParams = "EncodeFinderParams"
View Source
const PartialUpdateDeleteParam = "delete"
View Source
const PartialUpdateSetParam = "set"
View Source
const UpdateParam = "update"
Variables ¶
View Source
var ( PackagePrefix string CommentWrapWidth = 120 HeaderTemplate = template.Must(template.New("header").Parse(`DO NOT EDIT Code automatically generated by go-restli Source file: {{.SourceFile}}`)) )
View Source
var Logger = log.New(os.Stderr, "[go-restli] ", log.LstdFlags|log.Lshortfile)
View Source
var PrimitiveTypes = []PrimitiveType{ {Type: "int32", /* contains filtered or unexported fields */}, {Type: "int64", /* contains filtered or unexported fields */}, {Type: "float32", /* contains filtered or unexported fields */}, {Type: "float64", /* contains filtered or unexported fields */}, {Type: "bool", /* contains filtered or unexported fields */}, {Type: "string", /* contains filtered or unexported fields */}, {Type: "bytes", /* contains filtered or unexported fields */}, }
View Source
var TypeRegistry = make(typeRegistry)
Functions ¶
func AddFuncOnReceiver ¶
func AddFuncOnReceiver(def *Statement, receiver, typeName, funcName string) *Statement
func AddMarshalJSON ¶
func AddMarshalJSON(def *Statement, receiver, typeName string, f func(def *Group)) *Statement
func AddRestLiDecode ¶
func AddRestLiDecode(def *Statement, receiver, typeName string, f func(def *Group)) *Statement
func AddRestLiEncode ¶
func AddRestLiEncode(def *Statement, receiver, typeName string, f func(def *Group)) *Statement
func AddStringer ¶
func AddStringer(def *Statement, receiver, typeName string, f func(def *Group)) *Statement
func AddUnmarshalJSON ¶
func AddUnmarshalJSON(def *Statement, receiver, typeName string, f func(def *Group)) *Statement
func AddWordWrappedComment ¶
func AddWordWrappedComment(code *Statement, comment string) *Statement
func ExportedIdentifier ¶
func FqcpToPackagePath ¶
func GenerateAllImportsFile ¶
func GenerateCode ¶
func IfErrReturn ¶
func IfErrReturn(def *Group, results ...Code) *Group
func PrivateIdentifier ¶
func ReceiverName ¶
func RestLiMethod ¶
func RestLiMethod(method protocol.RestLiMethod) *Statement
func WriteJenFile ¶
Types ¶
type CodeFile ¶
func (*CodeFile) Identifier ¶
type ComplexType ¶
type ComplexType interface { GetIdentifier() Identifier GetSourceFile() string InnerTypes() IdentifierSet GenerateCode() *jen.Statement }
type Enum ¶
func (*Enum) GenerateCode ¶
func (e *Enum) GenerateCode() (def *Statement)
func (*Enum) InnerTypes ¶
func (e *Enum) InnerTypes() IdentifierSet
func (*Enum) SymbolIdentifier ¶
type Field ¶
type Field struct { Type RestliType Name string Doc string IsOptional bool DefaultValue *string }
type FinderParams ¶
type FinderParams Record
func (*FinderParams) GenerateCode ¶
func (p *FinderParams) GenerateCode(f *Method) *Statement
type Fixed ¶
func (*Fixed) GenerateCode ¶
func (f *Fixed) GenerateCode() (def *Statement)
func (*Fixed) InnerTypes ¶
func (f *Fixed) InnerTypes() IdentifierSet
type GoRestliSpec ¶
type GoRestliSpec struct { DataTypes []struct { Enum *Enum Fixed *Fixed Record *Record Typeref *Typeref } Resources []Resource }
func (*GoRestliSpec) GenerateClientCode ¶
func (s *GoRestliSpec) GenerateClientCode() (codeFiles []*CodeFile)
func (*GoRestliSpec) UnmarshalJSON ¶
func (s *GoRestliSpec) UnmarshalJSON(data []byte) error
type Identifier ¶
func (*Identifier) GetIdentifier ¶
func (i *Identifier) GetIdentifier() Identifier
func (Identifier) GetQualifiedClasspath ¶
func (i Identifier) GetQualifiedClasspath() string
func (Identifier) PackagePath ¶
func (i Identifier) PackagePath() string
func (*Identifier) Receiver ¶
func (i *Identifier) Receiver() string
func (*Identifier) Resolve ¶
func (i *Identifier) Resolve() ComplexType
func (Identifier) String ¶
func (i Identifier) String() string
type IdentifierSet ¶
type IdentifierSet map[Identifier]bool
func (IdentifierSet) Add ¶
func (set IdentifierSet) Add(id Identifier)
func (IdentifierSet) AddAll ¶
func (set IdentifierSet) AddAll(other IdentifierSet)
func (IdentifierSet) Get ¶
func (set IdentifierSet) Get(id Identifier) bool
func (IdentifierSet) Remove ¶
func (set IdentifierSet) Remove(id Identifier)
func (IdentifierSet) String ¶
func (set IdentifierSet) String() string
type Method ¶
type Method struct { MethodType MethodType Name string Doc string Path string OnEntity bool PathKeys []PathKey Params []Field Return *RestliType }
func (*Method) RestLiMethod ¶
func (m *Method) RestLiMethod() protocol.RestLiMethod
type MethodType ¶
type MethodType string
const ( REST_METHOD MethodType = "REST_METHOD" ACTION MethodType = "ACTION" FINDER MethodType = "FINDER" )
type NamedType ¶
type NamedType struct { Identifier SourceFile string Doc string }
func (*NamedType) GetSourceFile ¶
type Path ¶
type Path []Identifier
func (Path) Add ¶
func (p Path) Add(id Identifier) Path
func (Path) IntroducesCycle ¶
func (p Path) IntroducesCycle(nextNode Identifier) Path
func (Path) SeenNode ¶
func (p Path) SeenNode(id Identifier) bool
type PathKey ¶
type PathKey struct { Name string Type RestliType }
type PrimitiveType ¶
type PrimitiveType struct { Type string // contains filtered or unexported fields }
func (*PrimitiveType) Cast ¶
func (p *PrimitiveType) Cast(accessor *Statement) *Statement
func (*PrimitiveType) GoType ¶
func (p *PrimitiveType) GoType() *Statement
func (*PrimitiveType) IsBytes ¶
func (p *PrimitiveType) IsBytes() bool
func (*PrimitiveType) UnmarshalJSON ¶
func (p *PrimitiveType) UnmarshalJSON(data []byte) error
type Record ¶
func (*Record) GenerateCode ¶
func (r *Record) GenerateCode() (def *Statement)
func (*Record) InnerTypes ¶
func (r *Record) InnerTypes() IdentifierSet
type Resource ¶
type Resource struct { Namespace string Doc string SourceFile string RootResourceName string ResourceSchema *RestliType Methods []*Method }
func (*Resource) GenerateActionCode ¶
func (*Resource) GenerateCode ¶
func (*Resource) GenerateFinderCode ¶
func (*Resource) GenerateRestMethodCode ¶
https://linkedin.github.io/rest.li/user_guide/restli_server#resource-methods
func (*Resource) NewCodeFile ¶
func (*Resource) PackagePath ¶
type RestliType ¶
type RestliType struct { Primitive *PrimitiveType Reference *Identifier Array *RestliType Map *RestliType Union *UnionType }
func (*RestliType) GoType ¶
func (t *RestliType) GoType() *Statement
func (*RestliType) InnerTypes ¶
func (t *RestliType) InnerTypes() IdentifierSet
func (*RestliType) IsMapOrArray ¶
func (t *RestliType) IsMapOrArray() bool
func (*RestliType) IsUnion ¶
func (t *RestliType) IsUnion() bool
func (*RestliType) PointerType ¶
func (t *RestliType) PointerType() *Statement
func (*RestliType) ReferencedType ¶
func (t *RestliType) ReferencedType() *Statement
func (*RestliType) RestLiEncodeModel ¶
func (t *RestliType) RestLiEncodeModel(encoder string, accessor *Statement) (*Statement, bool)
func (*RestliType) RestLiReducedEncodeModel ¶
func (t *RestliType) RestLiReducedEncodeModel(accessor *Statement) (def *Statement, hasError bool)
func (*RestliType) RestLiURLEncodeModel ¶
func (t *RestliType) RestLiURLEncodeModel(accessor *Statement) (def *Statement, hasError bool)
func (*RestliType) UnmarshalJSON ¶
func (t *RestliType) UnmarshalJSON(data []byte) error
func (*RestliType) WriteToBuf ¶
func (t *RestliType) WriteToBuf(def *Group, accessor *Statement)
type Typeref ¶
type Typeref struct { NamedType Ref RestliType }
func (*Typeref) GenerateCode ¶
func (r *Typeref) GenerateCode() (def *Statement)
func (*Typeref) InnerTypes ¶
func (r *Typeref) InnerTypes() IdentifierSet
type UnionMember ¶
type UnionMember struct { Type RestliType Alias string }
type UnionType ¶
type UnionType []UnionMember
func (*UnionType) InnerModels ¶
func (u *UnionType) InnerModels() IdentifierSet
Source Files ¶
Click to show internal directories.
Click to hide internal directories.