types

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2022 License: BSD-2-Clause Imports: 11 Imported by: 2

Documentation

Index

Constants

View Source
const (
	PartialUpdate = "_PartialUpdate"
	DeleteFields  = "Delete_Fields"
	SetFields     = "Set_Fields"
)
View Source
const EnumShouldUsePointer = utils.No
View Source
const FixedShouldUsePointer = utils.Yes
View Source
const NewInstance = "NewInstance"
View Source
const RecordShouldUsePointer = utils.Yes
View Source
const TyperefShouldUsePointer = utils.No
View Source
const UnionShouldUsePointer = utils.Yes

Variables

View Source
var (
	Int32Primitive   = PrimitiveType{Type: "int32", /* contains filtered or unexported fields */}
	Int64Primitive   = PrimitiveType{Type: "int64", /* contains filtered or unexported fields */}
	Float32Primitive = PrimitiveType{Type: "float32", /* contains filtered or unexported fields */}
	Float64Primitive = PrimitiveType{Type: "float64", /* contains filtered or unexported fields */}
	BoolPrimitive    = PrimitiveType{Type: "bool", /* contains filtered or unexported fields */}
	StringPrimitive  = PrimitiveType{Type: "string", /* contains filtered or unexported fields */}
	BytesPrimitive   = PrimitiveType{Type: "bytes"}
)
View Source
var (
	KeyWriter   = Code(Id("keyWriter"))
	ItemWriter  = Code(Id("itemWriter"))
	Writer      = &writer{Id("writer")}
	WriterQual  = Code(Qual(utils.RestLiCodecPackage, "Writer"))
	WriterParam = Code(Add(Writer).Add(WriterQual))
)
View Source
var (
	Reader      = &reader{Id("reader")}
	ReaderQual  = Qual(utils.RestLiCodecPackage, "Reader")
	ReaderParam = Add(Reader).Add(ReaderQual)
)
View Source
var FixedUnderlyingType = RestliType{Primitive: &BytesPrimitive}

Functions

func AddComputeHash

func AddComputeHash(def *Statement, receiver, typeName string, pointer utils.ShouldUsePointer, f func(h Code, def *Group)) *Statement

func AddCustomComputeHash added in v0.26.8

func AddCustomComputeHash(def *Statement, receiver, typeName string, pointer utils.ShouldUsePointer, f func(def *Group)) *Statement

func AddEquals

func AddEquals(def *Statement, receiver, typeName string, pointer utils.ShouldUsePointer, f func(other Code, def *Group)) *Statement

func AddMarshalRestLi

func AddMarshalRestLi(def *Statement, receiver, typeName string, pointer utils.ShouldUsePointer, f func(def *Group)) *Statement

func AddNewInstance added in v1.0.3

func AddNewInstance(def *Statement, receiver, typeName string)

func AddUnmarshalRestli

func AddUnmarshalRestli(def *Statement, receiver, typeName string, pointer utils.ShouldUsePointer, f func(def *Group)) *Statement

Types

type ComplexKey

type ComplexKey struct {
	NamedType
	Key    utils.Identifier
	Params utils.Identifier
}

func (*ComplexKey) GenerateCode

func (ck *ComplexKey) GenerateCode() *Statement

func (*ComplexKey) InnerTypes

func (ck *ComplexKey) InnerTypes() utils.IdentifierSet

func (*ComplexKey) KeyAccessor

func (ck *ComplexKey) KeyAccessor() Code

func (*ComplexKey) ShouldReference added in v1.0.0

func (ck *ComplexKey) ShouldReference() utils.ShouldUsePointer

type Enum

type Enum struct {
	NamedType
	Symbols     []string
	SymbolToDoc map[string]string
}

func (*Enum) GenerateCode

func (e *Enum) GenerateCode() (def *Statement)

func (*Enum) InnerTypes

func (e *Enum) InnerTypes() utils.IdentifierSet

func (*Enum) ShouldReference added in v1.0.0

func (e *Enum) ShouldReference() utils.ShouldUsePointer

func (*Enum) SymbolIdentifier

func (e *Enum) SymbolIdentifier(symbol string) string

type Field

type Field struct {
	Type         RestliType
	Name         string
	Doc          string
	IsOptional   bool
	DefaultValue *string
	IncludedFrom *utils.Identifier
	// contains filtered or unexported fields
}

func (*Field) FieldName

func (f *Field) FieldName() string

func (*Field) IsOptionalOrDefault

func (f *Field) IsOptionalOrDefault() bool

func (*Field) ResolveRecord

func (f *Field) ResolveRecord() *Record

type Fixed

type Fixed struct {
	NamedType
	Size int
}

func (*Fixed) GenerateCode

func (f *Fixed) GenerateCode() (def *Statement)

func (*Fixed) InnerTypes

func (f *Fixed) InnerTypes() utils.IdentifierSet

func (*Fixed) ShouldReference added in v1.0.0

func (f *Fixed) ShouldReference() utils.ShouldUsePointer

type NamedType

type NamedType struct {
	utils.Identifier
	SourceFile string `json:"sourceFile"`
	Doc        string `json:"doc"`
}

func (*NamedType) GetSourceFile

func (t *NamedType) GetSourceFile() string

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

func (p *PrimitiveType) HasherName() string

func (*PrimitiveType) HasherQual added in v1.0.0

func (p *PrimitiveType) HasherQual() Code

func (*PrimitiveType) IsBytes

func (p *PrimitiveType) IsBytes() bool

func (*PrimitiveType) MarshalerFunc added in v1.0.0

func (p *PrimitiveType) MarshalerFunc() *Statement

func (*PrimitiveType) ReaderName

func (p *PrimitiveType) ReaderName() string

func (*PrimitiveType) UnmarshalJSON

func (p *PrimitiveType) UnmarshalJSON(data []byte) error

func (*PrimitiveType) UnmarshalerFunc added in v1.0.0

func (p *PrimitiveType) UnmarshalerFunc() *Statement

func (*PrimitiveType) WriterName

func (p *PrimitiveType) WriterName() string

type RawRecord

type RawRecord struct{}

func (*RawRecord) GenerateCode

func (r *RawRecord) GenerateCode() (def *Statement)

func (*RawRecord) GetIdentifier

func (r *RawRecord) GetIdentifier() utils.Identifier

func (*RawRecord) GetSourceFile

func (r *RawRecord) GetSourceFile() string

func (*RawRecord) InnerTypes

func (r *RawRecord) InnerTypes() utils.IdentifierSet

func (*RawRecord) ShouldReference added in v1.0.0

func (r *RawRecord) ShouldReference() utils.ShouldUsePointer

type Record

type Record struct {
	NamedType
	Fields []Field
}

func (*Record) GenerateCode

func (r *Record) GenerateCode() *Statement

func (*Record) GenerateComputeHash

func (r *Record) GenerateComputeHash() Code

func (*Record) GenerateEquals

func (r *Record) GenerateEquals() Code

func (*Record) GenerateMarshalRestLi

func (r *Record) GenerateMarshalRestLi() *Statement

func (*Record) GeneratePopulateDefaultValues added in v1.0.3

func (r *Record) GeneratePopulateDefaultValues() Code

func (*Record) GenerateQueryParamMarshaler

func (r *Record) GenerateQueryParamMarshaler(finderName *string, batchKeyType *RestliType) *Statement

func (*Record) GenerateQueryParamUnmarshaler added in v1.0.3

func (r *Record) GenerateQueryParamUnmarshaler(batchKeyType *RestliType) Code

func (*Record) GenerateStruct

func (r *Record) GenerateStruct() *Statement

func (*Record) GenerateUnmarshalRestLi

func (r *Record) GenerateUnmarshalRestLi() *Statement

func (*Record) InnerTypes

func (r *Record) InnerTypes() utils.IdentifierSet

func (*Record) PartialUpdateDeleteFieldsStructName added in v1.0.0

func (r *Record) PartialUpdateDeleteFieldsStructName() string

func (*Record) PartialUpdateSetFieldsStructName added in v1.0.0

func (r *Record) PartialUpdateSetFieldsStructName() string

func (*Record) PartialUpdateStruct

func (r *Record) PartialUpdateStruct() *Statement

func (*Record) PartialUpdateStructName

func (r *Record) PartialUpdateStructName() string

func (*Record) ShouldReference added in v1.0.0

func (r *Record) ShouldReference() utils.ShouldUsePointer

func (*Record) SortedFields

func (r *Record) SortedFields() (fields []Field)

type RestliType

type RestliType struct {
	Primitive *PrimitiveType    `json:"primitive"`
	Reference *utils.Identifier `json:"reference"`
	Array     *RestliType       `json:"array"`
	Map       *RestliType       `json:"map"`
	RawRecord bool              `json:"rawRecord"`
}

func (*RestliType) ComplexKey

func (t *RestliType) ComplexKey() *ComplexKey

func (*RestliType) Enum

func (t *RestliType) Enum() *Enum

func (*RestliType) GoType

func (t *RestliType) GoType() *Statement

func (*RestliType) InnerMapOrArray added in v1.0.0

func (t *RestliType) InnerMapOrArray() (innerT RestliType, word string)

func (*RestliType) InnerTypes

func (t *RestliType) InnerTypes() utils.IdentifierSet

func (*RestliType) IsMapOrArray

func (t *RestliType) IsMapOrArray() bool

func (*RestliType) PointerType

func (t *RestliType) PointerType() *Statement

func (*RestliType) Record

func (t *RestliType) Record() *Record

func (*RestliType) ReferencedType

func (t *RestliType) ReferencedType() *Statement

func (*RestliType) ShouldReference

func (t *RestliType) ShouldReference() bool

func (*RestliType) StandaloneUnion

func (t *RestliType) StandaloneUnion() *StandaloneUnion

func (*RestliType) Typeref

func (t *RestliType) Typeref() *Typeref

func (*RestliType) UnmarshalJSON

func (t *RestliType) UnmarshalJSON(data []byte) error

type StandaloneUnion

type StandaloneUnion struct {
	NamedType
	Union UnionType `json:"Union"`
}

func (*StandaloneUnion) GenerateCode

func (u *StandaloneUnion) GenerateCode() *Statement

func (*StandaloneUnion) InnerTypes

func (u *StandaloneUnion) InnerTypes() utils.IdentifierSet

func (*StandaloneUnion) ShouldReference added in v1.0.0

func (u *StandaloneUnion) ShouldReference() utils.ShouldUsePointer

type Typeref

type Typeref struct {
	NamedType
	Type *PrimitiveType `json:"type"`
}

func (*Typeref) GenerateCode

func (r *Typeref) GenerateCode() (def *Statement)

func (*Typeref) InnerTypes

func (r *Typeref) InnerTypes() utils.IdentifierSet

func (*Typeref) ShouldReference added in v1.0.0

func (r *Typeref) ShouldReference() utils.ShouldUsePointer

type UnionMember

type UnionMember struct {
	Type  RestliType
	Alias string
}

type UnionType

type UnionType struct {
	HasNull bool
	Members []UnionMember
}

func (*UnionType) GoType

func (u *UnionType) GoType() *Statement

func (*UnionType) InnerModels

func (u *UnionType) InnerModels() utils.IdentifierSet

Jump to

Keyboard shortcuts

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