Documentation ¶
Index ¶
- Constants
- Variables
- type Action
- func (a *Action) FuncName() string
- func (a *Action) FuncParamNames() []Code
- func (a *Action) FuncParamTypes() []Code
- func (a *Action) GenerateCode() *utils.CodeFile
- func (m *Action) GetMethod() *Method
- func (m *Action) GetPathKeys() (keys []*PathKey)
- func (a *Action) NonErrorFuncReturnParam() Code
- func (a *Action) RegisterMethod(server, resource, segments Code) Code
- type Finder
- func (f *Finder) FuncName() string
- func (f *Finder) FuncParamNames() []Code
- func (f *Finder) FuncParamTypes() []Code
- func (f *Finder) GenerateCode() *utils.CodeFile
- func (m *Finder) GetMethod() *Method
- func (m *Finder) GetPathKeys() (keys []*PathKey)
- func (f *Finder) NonErrorFuncReturnParam() Code
- func (f *Finder) RegisterMethod(server, resource, segments Code) Code
- type Method
- type MethodImplementation
- type MethodType
- type PathKey
- type Resource
- func (r *Resource) GenerateCode() []*utils.CodeFile
- func (r *Resource) LastSegment() ResourcePathSegment
- func (r *Resource) LocalType(name string) *Statement
- func (r *Resource) NewCodeFile(filename string) *utils.CodeFile
- func (r *Resource) PackagePath() string
- func (r *Resource) ParentSegments() []ResourcePathSegment
- func (r *Resource) UnmarshalJSON(data []byte) (err error)
- type ResourcePathSegment
- type RestMethod
- func (r *RestMethod) EntityKeyType() *Statement
- func (r *RestMethod) EntityType() *Statement
- func (r *RestMethod) FuncName() string
- func (r *RestMethod) FuncParamNames() (params []Code)
- func (r *RestMethod) FuncParamTypes() (params []Code)
- func (r *RestMethod) GenerateCode() *utils.CodeFile
- func (r *RestMethod) GenericParams() Code
- func (m *RestMethod) GetMethod() *Method
- func (m *RestMethod) GetPathKeys() (keys []*PathKey)
- func (r *RestMethod) NonErrorFuncReturnParam() Code
- func (r *RestMethod) PartialEntityUpdateType() *Statement
- func (r *RestMethod) RegisterMethod(server, resource, segments Code) Code
Constants ¶
View Source
const ( ResourcePath = "ResourcePath" ResourceEntityPath = "ResourceEntityPath" WithContext = "WithContext" FindBy = "FindBy" RestLiClient = "Client" ClientReceiver = "c" ClientType = "client" ClientInterfaceType = "Client" ResourceInterfaceType = "Resource" CreatedEntity = "CreatedEntity" CreatedAndReturnedEntity = "CreatedAndReturnedEntity" Elements = "Elements" BatchEntities = "BatchEntities" BatchResponse = "BatchResponse" )
Variables ¶
View Source
var ( RestLiClientQual = Code(Qual(utils.RestLiPackage, RestLiClient)) RestLiClientReceiver = Code(Id(ClientReceiver).Dot(RestLiClient)) Context = Code(Qual("context", "Context")) RequestContext = Code(Op("*").Qual(utils.RestLiPackage, "RequestContext")) RequestContextParam = Code(Add(Ctx).Add(RequestContext)) ElementsWithMetadata = Code(Qual(utils.RestLiDataPackage, "ElementsWithMetadata")) BatchEntityUpdateResponse = Code(Op("*").Qual(utils.RestLiDataPackage, "BatchEntityUpdateResponse")) EmptyRecord = Code(Qual(utils.RestLiDataPackage, "EmptyRecord")) Rp = Code(Id("rp")) Ctx = Code(Id("ctx")) Entity = Code(Id("entity")) Entities = Code(Id("entities")) Results = Code(Id("results")) Keys = Code(Id("keys")) QueryParams = Code(Id("queryParams")) ActionParams = Code(Id("actionParams")) NoExcludedFields = Code(Qual(utils.RestLiCodecPackage, "NoExcludedFields")) ReadOnlyFields = Code(Id("ReadOnlyFields")) CreateAndReadOnlyFields = Code(Id("CreateAndReadOnlyFields")) )
View Source
var CollectionMetadata = &types.Record{ NamedType: types.NamedType{Identifier: utils.Identifier{ Namespace: utils.RestLiDataPackage, Name: "CollectionMedata", }}, Fields: []types.Field{ { Type: types.RestliType{Primitive: &types.Int32Primitive}, Name: "start", Doc: "The start index of this collection", }, { Type: types.RestliType{Primitive: &types.Int32Primitive}, Name: "count", Doc: "The number of elements in this collection segment", }, { Type: types.RestliType{Primitive: &types.Int32Primitive}, Name: "total", Doc: "The total number of elements in the entire collection (not just this segment)", DefaultValue: restli.StringPointer("0"), }, { Type: types.RestliType{Array: &types.RestliType{Reference: &Link.Identifier}}, Name: "links", }, }, }
CollectionMetadata is manually parsed from https://github.com/linkedin/rest.li/blob/master/restli-common/src/main/pegasus/com/linkedin/restli/common/CollectionMetadata.pdl
View Source
var ErrorResponse = &types.Record{ NamedType: types.NamedType{Identifier: utils.Identifier{ Namespace: utils.RestLiDataPackage, Name: "ErrorResponse", }}, Fields: []types.Field{ { Type: types.RestliType{Primitive: &types.Int32Primitive}, Name: "status", Doc: "The HTTP status code.", IsOptional: true, }, { Type: types.RestliType{Primitive: &types.StringPrimitive}, Name: "message", Doc: "A human-readable explanation of the error.", IsOptional: true, }, { Type: types.RestliType{Primitive: &types.StringPrimitive}, Name: "exceptionClass", Doc: "The FQCN of the exception thrown by the server.", IsOptional: true, }, { Type: types.RestliType{Primitive: &types.StringPrimitive}, Name: "stackTrace", Doc: "The full stack trace of the exception thrown by the server.", IsOptional: true, }, }, }
ErrorResponse is manually parsed from https://github.com/linkedin/rest.li/blob/master/restli-common/src/main/pegasus/com/linkedin/restli/common/ErrorResponse.pdl
View Source
var Link = &types.Record{ NamedType: types.NamedType{Identifier: utils.Identifier{ Namespace: utils.RestLiDataPackage, Name: "Link", }}, Fields: []types.Field{ { Type: types.RestliType{Primitive: &types.StringPrimitive}, Name: "rel", Doc: "The link relation e.g. 'self' or 'next'", }, { Type: types.RestliType{Primitive: &types.StringPrimitive}, Name: "href", Doc: "The link URI", }, { Type: types.RestliType{Primitive: &types.StringPrimitive}, Name: "type", Doc: "The type (media type) of the resource", }, }, }
Link is manually parsed from https://github.com/linkedin/rest.li/blob/master/restli-common/src/main/pegasus/com/linkedin/restli/common/Link.pdl
View Source
var PagingContext = &types.Record{ NamedType: types.NamedType{Identifier: utils.PagingContextIdentifier}, Fields: []types.Field{ { Type: types.RestliType{Primitive: &types.Int32Primitive}, Name: "start", IsOptional: true, IncludedFrom: &utils.PagingContextIdentifier, }, { Type: types.RestliType{Primitive: &types.Int32Primitive}, Name: "count", IsOptional: true, IncludedFrom: &utils.PagingContextIdentifier, }, }, }
Functions ¶
This section is empty.
Types ¶
type Action ¶
type Action struct {
// contains filtered or unexported fields
}
func (*Action) FuncParamNames ¶
func (a *Action) FuncParamNames() []Code
func (*Action) FuncParamTypes ¶
func (a *Action) FuncParamTypes() []Code
func (*Action) GenerateCode ¶
func (*Action) GetPathKeys ¶ added in v1.0.3
func (m *Action) GetPathKeys() (keys []*PathKey)
func (*Action) NonErrorFuncReturnParam ¶ added in v1.0.0
func (a *Action) NonErrorFuncReturnParam() Code
func (*Action) RegisterMethod ¶ added in v1.0.3
func (a *Action) RegisterMethod(server, resource, segments Code) Code
type Finder ¶
type Finder struct {
// contains filtered or unexported fields
}
func (*Finder) FuncParamNames ¶
func (f *Finder) FuncParamNames() []Code
func (*Finder) FuncParamTypes ¶
func (f *Finder) FuncParamTypes() []Code
func (*Finder) GenerateCode ¶
func (*Finder) GetPathKeys ¶ added in v1.0.3
func (m *Finder) GetPathKeys() (keys []*PathKey)
func (*Finder) NonErrorFuncReturnParam ¶ added in v1.0.0
func (f *Finder) NonErrorFuncReturnParam() Code
func (*Finder) RegisterMethod ¶ added in v1.0.3
func (f *Finder) RegisterMethod(server, resource, segments Code) Code
type Method ¶
type Method struct { MethodType MethodType `json:"methodType"` Name string `json:"name"` Doc string `json:"doc"` OnEntity bool `json:"onEntity"` Params []types.Field `json:"params"` Return *types.RestliType `json:"return"` Metadata *types.RestliType `json:"metadata"` ReturnEntity bool `json:"returnEntity"` }
type MethodImplementation ¶
type MethodType ¶
type MethodType string
const ( REST_METHOD MethodType = "REST_METHOD" ACTION MethodType = "ACTION" FINDER MethodType = "FINDER" )
type PathKey ¶
type PathKey struct { Name string `json:"name"` Type types.RestliType `json:"type"` }
func (*PathKey) UnmarshalJSON ¶ added in v1.0.3
type Resource ¶
type Resource struct { Namespace string `json:"namespace"` Doc string `json:"doc"` SourceFile string `json:"sourceFile"` ResourcePathSegments []ResourcePathSegment `json:"resourcePathSegments"` ResourceSchema *types.RestliType `json:"resourceSchema"` Methods []MethodImplementation `json:"-"` ReadOnlyFields []string `json:"readOnlyFields"` CreateOnlyFields []string `json:"createOnlyFields"` }
func (*Resource) GenerateCode ¶
func (*Resource) LastSegment ¶ added in v1.0.3
func (r *Resource) LastSegment() ResourcePathSegment
func (*Resource) PackagePath ¶
func (*Resource) ParentSegments ¶ added in v1.0.3
func (r *Resource) ParentSegments() []ResourcePathSegment
func (*Resource) UnmarshalJSON ¶
type ResourcePathSegment ¶ added in v1.0.3
type RestMethod ¶
type RestMethod struct {
// contains filtered or unexported fields
}
func (*RestMethod) EntityKeyType ¶ added in v1.0.3
func (r *RestMethod) EntityKeyType() *Statement
func (*RestMethod) EntityType ¶ added in v1.0.3
func (r *RestMethod) EntityType() *Statement
func (*RestMethod) FuncName ¶
func (r *RestMethod) FuncName() string
func (*RestMethod) FuncParamNames ¶
func (r *RestMethod) FuncParamNames() (params []Code)
func (*RestMethod) FuncParamTypes ¶
func (r *RestMethod) FuncParamTypes() (params []Code)
func (*RestMethod) GenerateCode ¶
func (r *RestMethod) GenerateCode() *utils.CodeFile
https://linkedin.github.io/rest.li/user_guide/restli_server#resource-methods
func (*RestMethod) GenericParams ¶ added in v1.0.3
func (r *RestMethod) GenericParams() Code
func (*RestMethod) GetPathKeys ¶ added in v1.0.3
func (m *RestMethod) GetPathKeys() (keys []*PathKey)
func (*RestMethod) NonErrorFuncReturnParam ¶ added in v1.0.0
func (r *RestMethod) NonErrorFuncReturnParam() Code
func (*RestMethod) PartialEntityUpdateType ¶ added in v1.0.3
func (r *RestMethod) PartialEntityUpdateType() *Statement
func (*RestMethod) RegisterMethod ¶ added in v1.0.3
func (r *RestMethod) RegisterMethod(server, resource, segments Code) Code
Click to show internal directories.
Click to hide internal directories.