resources

package
v2.0.8 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2023 License: BSD-2-Clause Imports: 9 Imported by: 0

Documentation

Index

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.RestLiCommonPackage, "ElementsWithMetadata"))
	BatchEntityUpdateResponse = Code(Op("*").Qual(utils.RestLiCommonPackage, "BatchEntityUpdateResponse"))
	EmptyRecord               = Code(Qual(utils.RestLiCommonPackage, "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 PagingContext = &types.Record{
	NamedType: types.NamedType{Identifier: utils.PagingContextIdentifier},
	Fields: []types.Field{
		{
			Type:       types.RestliType{Primitive: &types.Int32Primitive},
			Name:       "start",
			IsOptional: true,
		},
		{
			Type:       types.RestliType{Primitive: &types.Int32Primitive},
			Name:       "count",
			IsOptional: true,
		},
	},
}

Functions

This section is empty.

Types

type Action

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

func (*Action) FuncName

func (a *Action) FuncName() string

func (*Action) FuncParamNames

func (a *Action) FuncParamNames() []Code

func (*Action) FuncParamTypes

func (a *Action) FuncParamTypes() []Code

func (*Action) GenerateCode

func (a *Action) GenerateCode() *utils.CodeFile

func (*Action) GetMethod

func (m *Action) GetMethod() *Method

func (*Action) GetPathKeys

func (m *Action) GetPathKeys() (keys []*PathKey)

func (*Action) NonErrorFuncReturnParam

func (a *Action) NonErrorFuncReturnParam() Code

func (*Action) RegisterMethod

func (a *Action) RegisterMethod(server, resource, segments Code) Code

type Finder

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

func (*Finder) FuncName

func (f *Finder) FuncName() string

func (*Finder) FuncParamNames

func (f *Finder) FuncParamNames() []Code

func (*Finder) FuncParamTypes

func (f *Finder) FuncParamTypes() []Code

func (*Finder) GenerateCode

func (f *Finder) GenerateCode() *utils.CodeFile

func (*Finder) GetMethod

func (m *Finder) GetMethod() *Method

func (*Finder) GetPathKeys

func (m *Finder) GetPathKeys() (keys []*PathKey)

func (*Finder) NonErrorFuncReturnParam

func (f *Finder) NonErrorFuncReturnParam() Code

func (*Finder) RegisterMethod

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"`
	IsPagingSupported bool              `json:"isPagingSupported"`
	Return            *types.RestliType `json:"return"`
	Metadata          *types.RestliType `json:"metadata"`
	ReturnEntity      bool              `json:"returnEntity"`
}

type MethodImplementation

type MethodImplementation interface {
	GetMethod() *Method
	GetPathKeys() []*PathKey
	FuncName() string
	FuncParamNames() []Code
	FuncParamTypes() []Code
	NonErrorFuncReturnParam() Code
	GenerateCode() *utils.CodeFile
	RegisterMethod(server, resource, segments Code) Code
}

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) GoType

func (pk *PathKey) GoType() *Statement

func (*PathKey) UnmarshalJSON

func (pk *PathKey) UnmarshalJSON(data []byte) error

type Resource

type Resource struct {
	PackageRoot string `json:"-"`

	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 (r *Resource) GenerateCode() []*utils.CodeFile

func (*Resource) LastSegment

func (r *Resource) LastSegment() ResourcePathSegment

func (*Resource) LocalType

func (r *Resource) LocalType(name string) *Statement

func (*Resource) NewCodeFile

func (r *Resource) NewCodeFile(filename string) *utils.CodeFile

func (*Resource) PackagePath

func (r *Resource) PackagePath() string

func (*Resource) ParentSegments

func (r *Resource) ParentSegments() []ResourcePathSegment

func (*Resource) UnmarshalJSON

func (r *Resource) UnmarshalJSON(data []byte) (err error)

type ResourcePathSegment

type ResourcePathSegment struct {
	ResourceName string   `json:"resourceName"`
	PathKey      *PathKey `json:"pathKey"`
}

type RestMethod

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

func (*RestMethod) EntityKeyType

func (r *RestMethod) EntityKeyType() *Statement

func (*RestMethod) EntityType

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) GenericParams

func (r *RestMethod) GenericParams() Code

func (*RestMethod) GetMethod

func (m *RestMethod) GetMethod() *Method

func (*RestMethod) GetPathKeys

func (m *RestMethod) GetPathKeys() (keys []*PathKey)

func (*RestMethod) NonErrorFuncReturnParam

func (r *RestMethod) NonErrorFuncReturnParam() Code

func (*RestMethod) PartialEntityUpdateType

func (r *RestMethod) PartialEntityUpdateType() *Statement

func (*RestMethod) RegisterMethod

func (r *RestMethod) RegisterMethod(server, resource, segments Code) Code

Jump to

Keyboard shortcuts

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