Documentation ¶
Index ¶
- Constants
- Variables
- func AddFuncOnReceiver(def *Statement, receiver, typeName, funcName string, pointer ShouldUsePointer) *Statement
- 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(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 ReceiverName(typeName string) string
- func WriteJenFile(filename string, file *File) error
- type CodeFile
- type ComplexType
- type Identifier
- type IdentifierSet
- type Path
- type ShouldUsePointer
Constants ¶
View Source
const ( ReadOnlyPermissions = os.FileMode(0444) GeneratedFileSuffix = ".gr.go" ParsedSpecsFile = "parsed-specs.gr.json" )
View Source
const ( Yes = ShouldUsePointer(0) No = ShouldUsePointer(1) )
View Source
const ( MarshalRestLi = "MarshalRestLi" UnmarshalRestLi = "UnmarshalRestLi" EncodeQueryParams = "EncodeQueryParams" PopulateLocalDefaultValues = "populateLocalDefaultValues" Equals = "Equals" ComputeHash = "ComputeHash" ValidateUnionFields = "ValidateUnionFields" ComplexKeyParamsField = "Params" ComplexKeyParams = "$params" FinderNameParam = "q" RootPackage = "github.com/PapaCharlie/go-restli" HashPackage = RootPackage + "/fnv1a" RestLiPackage = RootPackage + "/restli" RestLiCodecPackage = RootPackage + "/restlicodec" RestLiDataPackage = RootPackage + "/restlidata" BatchKeySetPackage = RestLiPackage + "/batchkeyset" EqualsPackage = RestLiPackage + "/equals" )
Variables ¶
View Source
var ( Logger = log.New(os.Stderr, "[go-restli] ", log.LstdFlags|log.Lshortfile) PackagePrefix string HeaderTemplate = template.Must(template.New("header").Parse(`DO NOT EDIT Code automatically generated by github.com/PapaCharlie/go-restli Source file: {{.SourceFile}}`)) )
View Source
var ( NewJsonReader = Code(Qual(RestLiCodecPackage, "NewJsonReader")) RequiredFields = Code(Qual(RestLiCodecPackage, "RequiredFields")) 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")) )
View Source
var PagingContextIdentifier = Identifier{ Name: "PagingContext", Namespace: RestLiDataPackage, }
View Source
var RawRecordContextIdentifier = Identifier{ Name: "RawRecord", Namespace: RestLiDataPackage, }
View Source
var TypeRegistry = make(typeRegistry)
Functions ¶
func AddFuncOnReceiver ¶
func AddFuncOnReceiver(def *Statement, receiver, typeName, funcName string, pointer ShouldUsePointer) *Statement
func AddPointer ¶ added in v0.26.7
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 ¶ added in v1.0.0
func ExportedIdentifier ¶
func FqcpToPackagePath ¶
func IfErrReturn ¶
func IfErrReturn(results ...Code) *Statement
func OrderedValues ¶ added in v1.0.0
func OrderedValues(f func(add func(key, value Code))) *Statement
func ReceiverName ¶
func WriteJenFile ¶
Types ¶
type CodeFile ¶
func (*CodeFile) Identifier ¶
type ComplexType ¶
type ComplexType interface { GetIdentifier() Identifier GetSourceFile() string InnerTypes() IdentifierSet ShouldReference() ShouldUsePointer GenerateCode() *jen.Statement }
type Identifier ¶
func (*Identifier) GetIdentifier ¶
func (i *Identifier) GetIdentifier() Identifier
func (Identifier) PackagePath ¶
func (i Identifier) PackagePath() 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) String ¶
func (i Identifier) String() string
type IdentifierSet ¶
type IdentifierSet map[Identifier]bool
func NewIdentifierSet ¶
func NewIdentifierSet(ids ...Identifier) IdentifierSet
func (IdentifierSet) Add ¶
func (set IdentifierSet) Add(id Identifier) bool
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 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 ¶ added in v1.0.0
type ShouldUsePointer int
func (ShouldUsePointer) ShouldUsePointer ¶ added in v1.0.0
func (p ShouldUsePointer) ShouldUsePointer() bool
Click to show internal directories.
Click to hide internal directories.