Documentation ¶
Index ¶
- Constants
- Variables
- func AddFuncOnReceiver(def *Statement, receiver, typeName, funcName string, pointer ShouldUsePointer) *Statement
- func AddImportNames(f *File)
- func AddPointer(def *Statement, receiver, typeName string) *Statement
- func AddStringer(def *Statement, receiver, typeName string, pointer ShouldUsePointer, ...) *Statement
- func AddWordWrappedComment(code *Statement, comment string) *Statement
- func CleanTargetDir(targetDir string) (err error)
- func ExportedIdentifier(identifier string) string
- func FqcpToPackagePath(packageRoot string, fqcp string) string
- func IfErrReturn(results ...Code) *Statement
- func JsonFieldTag(name string, optional bool) map[string]string
- func OrderedValues(f func(add func(key, value Code))) *Statement
- func PackageName(pkg string) string
- func ReceiverName(typeName string) string
- func WriteJenFile(filename string, file *File) error
- type CodeFile
- type ComplexType
- type Identifier
- func (i Identifier) FullName() string
- func (i Identifier) GetIdentifier() Identifier
- func (i Identifier) IsCustomTyperef() bool
- func (i Identifier) IsEmptyRecord() bool
- func (i Identifier) PackagePath() string
- func (i Identifier) PackageRoot() string
- func (i Identifier) Qual() *jen.Statement
- func (i Identifier) Receiver() string
- func (i Identifier) Resolve() ComplexType
- func (i Identifier) TypeName() string
- type IdentifierSet
- type Path
- type ShouldUsePointer
Constants ¶
View Source
const ( ReadOnlyPermissions = os.FileMode(0444) GeneratedFileSuffix = ".gr.go" ManifestFile = "go-restli-manifest.gr.json" )
View Source
const ( Yes = ShouldUsePointer(0) No = ShouldUsePointer(1) )
View Source
const ( MarshalRestLi = "MarshalRestLi" UnmarshalRestLi = "UnmarshalRestLi" Marshal = "Marshal" Unmarshal = "Unmarshal" EncodeQueryParams = "EncodeQueryParams" PopulateLocalDefaultValues = "populateLocalDefaultValues" Equals = "Equals" ComputeHash = "ComputeHash" ValidateUnionFields = "ValidateUnionFields" ComplexKeyParamsField = "Params" ComplexKeyParams = "$params" FinderNameParam = "q" RootPackage = "github.com/PapaCharlie/go-restli/v2" HashPackage = RootPackage + "/fnv1a" RestLiPackage = RootPackage + "/restli" RestLiPatchPackage = RestLiPackage + "/patch" RestLiCodecPackage = RootPackage + "/restlicodec" RestLiDataPackage = RootPackage + "/restlidata" RestLiCommonPackage = RestLiDataPackage + "/generated/com/linkedin/restli/common" BatchKeySetPackage = RestLiPackage + "/batchkeyset" EqualsPackage = RestLiPackage + "/equals" )
Variables ¶
View Source
var ( DoNotEditHeader = `Code generated by "github.com/PapaCharlie/go-restli/v2"; DO NOT EDIT.` // HeaderTemplate is a template for the header of generated files. According to golang.org/s/generatedcode, // generated files must have a specific header syntax. HeaderTemplate = template.Must(template.New("header").Parse(DoNotEditHeader + ` Source file: {{.SourceFile}}`)) )
View Source
var ( NewJsonReader = Code(Qual(RestLiCodecPackage, "NewJsonReader")) NewRequiredFields = Code(Qual(RestLiCodecPackage, "NewRequiredFields")) WriteCustomTyperef = Code(Qual(RestLiCodecPackage, "WriteCustomTyperef")) ReadCustomTyperef = Code(Qual(RestLiCodecPackage, "ReadCustomTyperef")) BatchKeySet = Code(Id("set")) Hash = Code(Qual(HashPackage, "Hash")) NewHash = Code(Qual(HashPackage, "NewHash").Call()) ZeroHash = Code(Qual(HashPackage, "ZeroHash").Call()) IllegalEnumConstant = Code(Qual(RestLiPackage, "IllegalEnumConstant")) UnknownEnumValue = Code(Qual(RestLiPackage, "UnknownEnumValue")) MultiLineCall = Options{ Open: "(", Close: ")", Separator: ",", Multi: true, } MultiLineValues = Options{ Open: "{", Close: "}", Separator: ",", Multi: true, } )
View Source
var EmptyRecordIdentifier = Identifier{
Name: "EmptyRecord",
Namespace: "com.linkedin.restli.common",
}
View Source
var PagingContextIdentifier = Identifier{
Name: "PagingContext",
Namespace: "restlidata",
}
View Source
var RawRecordIdentifier = Identifier{
Name: "RawRecord",
Namespace: "restlidata",
}
View Source
var TypeRegistry = &typeRegistry{ types: map[Identifier]*registeredType{}, packageRoots: map[string]IdentifierSet{}, }
Functions ¶
func AddFuncOnReceiver ¶
func AddFuncOnReceiver(def *Statement, receiver, typeName, funcName string, pointer ShouldUsePointer) *Statement
func AddImportNames ¶
func AddImportNames(f *File)
func AddPointer ¶
func AddPointer(def *Statement, receiver, typeName string) *Statement
func AddStringer ¶
func AddStringer(def *Statement, receiver, typeName string, pointer ShouldUsePointer, f func(def *Group)) *Statement
func AddWordWrappedComment ¶
func AddWordWrappedComment(code *Statement, comment string) *Statement
func CleanTargetDir ¶
func ExportedIdentifier ¶
func FqcpToPackagePath ¶
func IfErrReturn ¶
func IfErrReturn(results ...Code) *Statement
func OrderedValues ¶
func OrderedValues(f func(add func(key, value Code))) *Statement
func PackageName ¶
func ReceiverName ¶
func WriteJenFile ¶
Types ¶
type CodeFile ¶
type ComplexType ¶
type ComplexType interface { GetIdentifier() Identifier GetSourceFile() string ReferencedTypes() IdentifierSet ShouldReference() ShouldUsePointer GenerateCode() *jen.Statement }
type Identifier ¶
func (Identifier) FullName ¶
func (i Identifier) FullName() string
func (Identifier) GetIdentifier ¶
func (i Identifier) GetIdentifier() Identifier
func (Identifier) IsCustomTyperef ¶
func (i Identifier) IsCustomTyperef() bool
func (Identifier) IsEmptyRecord ¶ added in v2.1.1
func (i Identifier) IsEmptyRecord() bool
func (Identifier) PackagePath ¶
func (i Identifier) PackagePath() string
func (Identifier) PackageRoot ¶
func (i Identifier) PackageRoot() string
func (Identifier) Qual ¶
func (i Identifier) Qual() *jen.Statement
func (Identifier) Receiver ¶
func (i Identifier) Receiver() string
func (Identifier) Resolve ¶
func (i Identifier) Resolve() ComplexType
func (Identifier) TypeName ¶
func (i Identifier) TypeName() string
type IdentifierSet ¶
type IdentifierSet map[Identifier]bool
func NewIdentifierSet ¶
func NewIdentifierSet(ids ...Identifier) (set IdentifierSet)
func (IdentifierSet) Add ¶
func (set IdentifierSet) Add(id Identifier)
func (IdentifierSet) AddAll ¶
func (set IdentifierSet) AddAll(other IdentifierSet)
func (IdentifierSet) Range ¶
func (set IdentifierSet) Range(f func(id Identifier))
func (IdentifierSet) Remove ¶
func (set IdentifierSet) Remove(id Identifier)
func (IdentifierSet) String ¶
func (set IdentifierSet) String() string
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 ShouldUsePointer ¶
type ShouldUsePointer int
func (ShouldUsePointer) ShouldUsePointer ¶
func (p ShouldUsePointer) ShouldUsePointer() bool
Click to show internal directories.
Click to hide internal directories.