types

package
v2.3.2 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2024 License: BSD-2-Clause Imports: 11 Imported by: 0

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 MarshalDeleteFields = "MarshalDeleteFields"
View Source
const MarshalFields = "MarshalFields"
View Source
const MarshalSetFields = "MarshalSetFields"
View Source
const NewInstance = "NewInstance"
View Source
const RecordShouldUsePointer = utils.Yes
View Source
const TyperefShouldUsePointer = utils.No
View Source
const UnionShouldUsePointer = utils.Yes
View Source
const UnmarshalDeleteField = "UnmarshalDeleteField"
View Source
const UnmarshalField = "UnmarshalField"
View Source
const UnmarshalSetField = "UnmarshalSetField"

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"))
	KeyWriterFunc  = Code(Add(KeyWriter).Func().Params(String()).Add(WriterQual))
	ItemWriter     = Code(Id("itemWriter"))
	ItemWriterFunc = Code(Add(ItemWriter).Func().Params().Add(WriterQual))
	Writer         = &writer{Id("writer")}
	WriterQual     = Code(Qual(utils.RestLiCodecPackage, "Writer"))
	WriterParam    = Code(Add(Writer).Add(WriterQual))
)
View Source
var (
	Reader         = &reader{Id("reader")}
	ReaderQual     = Code(Qual(utils.RestLiCodecPackage, "Reader"))
	ReaderParam    = Code(Add(Reader).Add(ReaderQual))
	FieldParamName = Code(Id("field"))
)
View Source
var FixedUnderlyingType = RestliType{Primitive: &BytesPrimitive}
View Source
var Found = Code(Id("found"))
View Source
var Ids = Code(Id(batchkeyset.EntityIDsField))

Functions

func AddComputeHash

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

func AddCustomComputeHash

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

func AddCustomTyperefComputeHash

func AddCustomTyperefComputeHash(name string, f func(def *Group, in, h Code)) *Statement

func AddCustomTyperefEquals

func AddCustomTyperefEquals(name string, f func(def *Group, left, right Code)) *Statement

func AddCustomTyperefMarshal

func AddCustomTyperefMarshal(name string, pt PrimitiveType, f func(def *Group, in, out Code)) *Statement

func AddCustomTyperefUnmarshal

func AddCustomTyperefUnmarshal(name string, pt PrimitiveType, f func(def *Group, in, out Code)) *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

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

func AddUnmarshalRestli

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

func CallRegisterCustomTyperef

func CallRegisterCustomTyperef(id utils.Identifier) *Statement

Types

type ComplexKey

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

func (*ComplexKey) GenerateCode

func (ck *ComplexKey) GenerateCode() *Statement

func (*ComplexKey) KeyAccessor

func (ck *ComplexKey) KeyAccessor() Code

func (*ComplexKey) ReferencedTypes added in v2.1.0

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

func (*ComplexKey) ShouldReference

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) ReferencedTypes added in v2.1.0

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

func (*Enum) ShouldReference

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

func (*Enum) SymbolIdentifier

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

type Field

type Field struct {
	Name         string     `json:"name"`
	Doc          string     `json:"doc"`
	Type         RestliType `json:"type"`
	IsOptional   bool       `json:"isOptional"`
	DefaultValue *string    `json:"defaultValue,omitempty"`
	// contains filtered or unexported fields
}

func (*Field) FieldName

func (f *Field) FieldName() string

func (*Field) IsOptionalOrDefault

func (f *Field) IsOptionalOrDefault() bool

type Fixed

type Fixed struct {
	NamedType
	Size int
}

func (*Fixed) GenerateCode

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

func (*Fixed) ReferencedTypes added in v2.1.0

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

func (*Fixed) ShouldReference

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

func (p *PrimitiveType) HasherQual() Code

func (*PrimitiveType) IsBytes

func (p *PrimitiveType) IsBytes() bool

func (*PrimitiveType) MarshalJSON

func (p *PrimitiveType) MarshalJSON() ([]byte, error)

func (*PrimitiveType) MarshalerFunc

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

func (p *PrimitiveType) UnmarshalerFunc() *Statement

func (*PrimitiveType) WriterName

func (p *PrimitiveType) WriterName() string

type Record

type Record struct {
	NamedType
	Includes []utils.Identifier `json:"includes"`
	Fields   []Field            `json:"fields"`
}

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

func (r *Record) GenerateMarshalFields() *Statement

func (*Record) GenerateMarshalRestLi

func (r *Record) GenerateMarshalRestLi() *Statement

func (*Record) GeneratePopulateDefaultValues

func (r *Record) GeneratePopulateDefaultValues() Code

func (*Record) GenerateQueryParamMarshaler

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

func (*Record) GenerateQueryParamUnmarshaler

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

func (*Record) GenerateStruct

func (r *Record) GenerateStruct() *Statement

func (*Record) GenerateUnmarshalField

func (r *Record) GenerateUnmarshalField(batchKeyType *RestliType) *Statement

func (*Record) GenerateUnmarshalRestLi

func (r *Record) GenerateUnmarshalRestLi() *Statement

func (*Record) PartialUpdateDeleteFieldsStructName

func (r *Record) PartialUpdateDeleteFieldsStructName() string

func (*Record) PartialUpdateSetFieldsStructName

func (r *Record) PartialUpdateSetFieldsStructName() string

func (*Record) PartialUpdateStruct

func (r *Record) PartialUpdateStruct() *Statement

func (*Record) PartialUpdateStructName

func (r *Record) PartialUpdateStructName() string

func (*Record) ReferencedTypes added in v2.1.0

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

func (*Record) ShouldReference

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

func (*Record) SortedFields

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

type RestliType

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

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

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

func (*RestliType) InnerTypes

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

func (*RestliType) IsCustomTyperef

func (t *RestliType) IsCustomTyperef() bool

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) ReferencedTypes added in v2.1.0

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

func (*StandaloneUnion) ShouldReference

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

type Typeref

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

func (*Typeref) GenerateCode

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

func (*Typeref) ReferencedTypes added in v2.1.0

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

func (*Typeref) ShouldReference

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