Documentation ¶
Index ¶
- Variables
- type Adapter
- func (p *Adapter) GetAdaptedType() string
- func (p *Adapter) GetExtraNamespace() string
- func (p *Adapter) GetMoveOnly() bool
- func (p *Adapter) GetName() string
- func (p *Adapter) GetUnderlyingName() string
- func (p *Adapter) Read(iprot thrift.Protocol) error
- func (p *Adapter) ReadField1(iprot thrift.Protocol) error
- func (p *Adapter) ReadField2(iprot thrift.Protocol) error
- func (p *Adapter) ReadField3(iprot thrift.Protocol) error
- func (p *Adapter) ReadField4(iprot thrift.Protocol) error
- func (p *Adapter) ReadField5(iprot thrift.Protocol) error
- func (a *Adapter) SetAdaptedType(adaptedType string) *Adapter
- func (a *Adapter) SetExtraNamespace(extraNamespace string) *Adapter
- func (a *Adapter) SetMoveOnly(moveOnly bool) *Adapter
- func (a *Adapter) SetName(name string) *Adapter
- func (a *Adapter) SetUnderlyingName(underlyingName string) *Adapter
- func (p *Adapter) String() string
- func (p *Adapter) Write(oprot thrift.Protocol) error
- type AdapterBuilder
- func (a *AdapterBuilder) AdaptedType(adaptedType string) *AdapterBuilder
- func (p AdapterBuilder) Emit() *Adapter
- func (a *AdapterBuilder) ExtraNamespace(extraNamespace string) *AdapterBuilder
- func (a *AdapterBuilder) MoveOnly(moveOnly bool) *AdapterBuilder
- func (a *AdapterBuilder) Name(name string) *AdapterBuilder
- func (a *AdapterBuilder) UnderlyingName(underlyingName string) *AdapterBuilder
- type DisableLazyChecksum
- type DisableLazyChecksumBuilder
- type EnumType
- func (p *EnumType) GetType() EnumUnderlyingType
- func (p *EnumType) Read(iprot thrift.Protocol) error
- func (p *EnumType) ReadField1(iprot thrift.Protocol) error
- func (e *EnumType) SetType(type_a1 EnumUnderlyingType) *EnumType
- func (p *EnumType) String() string
- func (p *EnumType) Write(oprot thrift.Protocol) error
- type EnumTypeBuilder
- type EnumUnderlyingType
- type FieldInterceptor
- func (p *FieldInterceptor) GetName() string
- func (p *FieldInterceptor) GetNoinline() bool
- func (p *FieldInterceptor) Read(iprot thrift.Protocol) error
- func (p *FieldInterceptor) ReadField1(iprot thrift.Protocol) error
- func (p *FieldInterceptor) ReadField2(iprot thrift.Protocol) error
- func (f *FieldInterceptor) SetName(name string) *FieldInterceptor
- func (f *FieldInterceptor) SetNoinline(noinline bool) *FieldInterceptor
- func (p *FieldInterceptor) String() string
- func (p *FieldInterceptor) Write(oprot thrift.Protocol) error
- type FieldInterceptorBuilder
- type Lazy
- type LazyBuilder
- type MinimizePadding
- type MinimizePaddingBuilder
- type PackIsset
- type PackIssetBuilder
- type Ref
- type RefBuilder
- type RefType
- type ScopedEnumAsUnionType
- type ScopedEnumAsUnionTypeBuilder
- type StrongType
- type StrongTypeBuilder
- type TriviallyRelocatable
- type TriviallyRelocatableBuilder
- type UseOpEncode
- type UseOpEncodeBuilder
Constants ¶
This section is empty.
Variables ¶
var EnumUnderlyingTypeNames = []string{
"I8",
"U8",
"I16",
"U16",
"U32",
}
var EnumUnderlyingTypeToName = map[EnumUnderlyingType]string{ EnumUnderlyingType_I8: "I8", EnumUnderlyingType_U8: "U8", EnumUnderlyingType_I16: "I16", EnumUnderlyingType_U16: "U16", EnumUnderlyingType_U32: "U32", }
var EnumUnderlyingTypeToValue = map[string]EnumUnderlyingType{ "I8": EnumUnderlyingType_I8, "U8": EnumUnderlyingType_U8, "I16": EnumUnderlyingType_I16, "U16": EnumUnderlyingType_U16, "U32": EnumUnderlyingType_U32, }
var EnumUnderlyingTypeValues = []EnumUnderlyingType{ EnumUnderlyingType_I8, EnumUnderlyingType_U8, EnumUnderlyingType_I16, EnumUnderlyingType_U16, EnumUnderlyingType_U32, }
var GoUnusedProtection__ int
var RefTypeNames = []string{
"Unique",
"Shared",
"SharedMutable",
}
var RefTypeToName = map[RefType]string{ RefType_Unique: "Unique", RefType_Shared: "Shared", RefType_SharedMutable: "SharedMutable", }
var RefTypeToValue = map[string]RefType{ "Unique": RefType_Unique, "Shared": RefType_Shared, "SharedMutable": RefType_SharedMutable, }
var RefTypeValues = []RefType{ RefType_Unique, RefType_Shared, RefType_SharedMutable, }
Functions ¶
This section is empty.
Types ¶
type Adapter ¶
type Adapter struct { Name string `thrift:"name,1" db:"name" json:"name"` AdaptedType string `thrift:"adaptedType,2" db:"adaptedType" json:"adaptedType"` UnderlyingName string `thrift:"underlyingName,3" db:"underlyingName" json:"underlyingName"` ExtraNamespace string `thrift:"extraNamespace,4" db:"extraNamespace" json:"extraNamespace"` MoveOnly bool `thrift:"moveOnly,5" db:"moveOnly" json:"moveOnly"` }
An annotation that applies a C++ adapter to typedef, field, or struct.
For example:
@cpp.Adapter{name = "::ns::IdAdapter"} typedef i64 MyI64;
Here the type `MyI64` has the C++ adapter `IdAdapter`.
struct User { @cpp.Adapter{name = "::ns::IdAdapter"} 1: i64 id; }
Here the field `id` has the C++ adapter `IdAdapter`.
Attributes:
- Name: The name of a C++ adapter type used to convert between Thrift and native
C++ representation.
The adapter can be either a Type or Field adapter, providing either of the following APIs:
struct ThriftTypeAdapter { static AdaptedType fromThrift(ThriftType thrift); static {const ThriftType& | ThriftType} toThrift(const AdaptedType& native); }; struct ThriftFieldAdapter { // Context is an instantiation of apache::thrift::FieldContext template <class Context> static void construct(AdaptedType& field, Context ctx); template <class Context> static AdaptedType fromThriftField(ThriftType value, Context ctx); template <class Context> static {const ThriftType& | ThriftType} toThrift(const AdaptedType& adapted, Context ctx); }; - AdaptedType: It is sometimes necessary to specify AdaptedType here (in case the codegen would
have a circular depdenceny, which will cause the C++ build to fail).
- UnderlyingName: The name and/or extra namespace to use when directly adapting a type
(as opposed a typedef).
In this case, the IDL name of the type will refer to the adapted type in C++ and the underlying thrift type will be generated in a nested namespace and/or with a different name.
If neither `underlyingName` or `extraNamespace` is provided, the underlying type will be generated in a nested 'detail' namespace with the same name.
- ExtraNamespace
- MoveOnly: Must set to true when adapted type is not copyable.
func NewAdapter ¶
func NewAdapter() *Adapter
func (*Adapter) GetAdaptedType ¶
func (*Adapter) GetExtraNamespace ¶
func (*Adapter) GetMoveOnly ¶
func (*Adapter) GetUnderlyingName ¶
func (*Adapter) SetAdaptedType ¶
func (*Adapter) SetExtraNamespace ¶
func (*Adapter) SetMoveOnly ¶
func (*Adapter) SetUnderlyingName ¶
type AdapterBuilder ¶
type AdapterBuilder struct {
// contains filtered or unexported fields
}
func NewAdapterBuilder ¶
func NewAdapterBuilder() *AdapterBuilder
func (*AdapterBuilder) AdaptedType ¶
func (a *AdapterBuilder) AdaptedType(adaptedType string) *AdapterBuilder
func (AdapterBuilder) Emit ¶
func (p AdapterBuilder) Emit() *Adapter
func (*AdapterBuilder) ExtraNamespace ¶
func (a *AdapterBuilder) ExtraNamespace(extraNamespace string) *AdapterBuilder
func (*AdapterBuilder) MoveOnly ¶
func (a *AdapterBuilder) MoveOnly(moveOnly bool) *AdapterBuilder
func (*AdapterBuilder) Name ¶
func (a *AdapterBuilder) Name(name string) *AdapterBuilder
func (*AdapterBuilder) UnderlyingName ¶
func (a *AdapterBuilder) UnderlyingName(underlyingName string) *AdapterBuilder
type DisableLazyChecksum ¶
type DisableLazyChecksum struct { }
func NewDisableLazyChecksum ¶
func NewDisableLazyChecksum() *DisableLazyChecksum
func (*DisableLazyChecksum) String ¶
func (p *DisableLazyChecksum) String() string
type DisableLazyChecksumBuilder ¶
type DisableLazyChecksumBuilder struct {
// contains filtered or unexported fields
}
func NewDisableLazyChecksumBuilder ¶
func NewDisableLazyChecksumBuilder() *DisableLazyChecksumBuilder
func (DisableLazyChecksumBuilder) Emit ¶
func (p DisableLazyChecksumBuilder) Emit() *DisableLazyChecksum
type EnumType ¶
type EnumType struct {
Type EnumUnderlyingType `thrift:"type,1" db:"type" json:"type"`
}
Indicates an integer type for C++ to use as the underlying type of enum, for example:
@cpp.EnumType{type = cpp.EnumUnderlyingType.I8} enum Fruit { Apple = 0, Banana = 1, }
will be generated into the following:
enum class Fruit : ::std::int8_t { Apple = 0, Banana = 1, };
Attributes:
- Type
func NewEnumType ¶
func NewEnumType() *EnumType
func (*EnumType) GetType ¶
func (p *EnumType) GetType() EnumUnderlyingType
func (*EnumType) SetType ¶
func (e *EnumType) SetType(type_a1 EnumUnderlyingType) *EnumType
type EnumTypeBuilder ¶
type EnumTypeBuilder struct {
// contains filtered or unexported fields
}
func NewEnumTypeBuilder ¶
func NewEnumTypeBuilder() *EnumTypeBuilder
func (EnumTypeBuilder) Emit ¶
func (p EnumTypeBuilder) Emit() *EnumType
func (*EnumTypeBuilder) Type ¶
func (e *EnumTypeBuilder) Type(type_a1 EnumUnderlyingType) *EnumTypeBuilder
type EnumUnderlyingType ¶
type EnumUnderlyingType int64
Enum in C++ by default uses signed 32 bit integer. There is no need to specify underlying type for signed 32 bit integer.
const ( EnumUnderlyingType_I8 EnumUnderlyingType = 0 EnumUnderlyingType_U8 EnumUnderlyingType = 1 EnumUnderlyingType_I16 EnumUnderlyingType = 2 EnumUnderlyingType_U16 EnumUnderlyingType = 3 EnumUnderlyingType_U32 EnumUnderlyingType = 4 )
func EnumUnderlyingTypeFromString ¶
func EnumUnderlyingTypeFromString(s string) (EnumUnderlyingType, error)
func EnumUnderlyingTypePtr ¶
func EnumUnderlyingTypePtr(v EnumUnderlyingType) *EnumUnderlyingType
func (EnumUnderlyingType) String ¶
func (p EnumUnderlyingType) String() string
type FieldInterceptor ¶
type FieldInterceptor struct { Name string `thrift:"name,1" db:"name" json:"name"` Noinline bool `thrift:"noinline,2" db:"noinline" json:"noinline"` }
An annotation that intercepts field access with C++ field interceptor. Use with *caution* since this may introduce substantial performance overhead on each field access.
For example:
struct Foo { @cpp.FieldInterceptor{name = "MyFieldInterceptor"} 1: i64 id; }
The field interceptor `MyFieldInterceptor` will intercept with `interceptThriftFieldAccess` when the field `id` is accessed.
Attributes:
- Name: The name of a field interceptor.
The field interceptor provides the following API:
struct ThriftFieldInterceptor { template <typename T, typename Struct, int16_t FieldId> static void interceptThriftFieldAccess(T&& field, apache::thrift::FieldContext<Struct, FieldId>&& ctx); };
The field interceptor intercepts with the field value and the field context. It enforces an easily searchable function name `interceptThriftFieldAccess`.
- Noinline: Setting to true makes compiler not inline and erase function signature for
the intercepting field accessor.
func NewFieldInterceptor ¶
func NewFieldInterceptor() *FieldInterceptor
func (*FieldInterceptor) GetName ¶
func (p *FieldInterceptor) GetName() string
func (*FieldInterceptor) GetNoinline ¶
func (p *FieldInterceptor) GetNoinline() bool
func (*FieldInterceptor) ReadField1 ¶
func (p *FieldInterceptor) ReadField1(iprot thrift.Protocol) error
func (*FieldInterceptor) ReadField2 ¶
func (p *FieldInterceptor) ReadField2(iprot thrift.Protocol) error
func (*FieldInterceptor) SetName ¶
func (f *FieldInterceptor) SetName(name string) *FieldInterceptor
func (*FieldInterceptor) SetNoinline ¶
func (f *FieldInterceptor) SetNoinline(noinline bool) *FieldInterceptor
func (*FieldInterceptor) String ¶
func (p *FieldInterceptor) String() string
type FieldInterceptorBuilder ¶
type FieldInterceptorBuilder struct {
// contains filtered or unexported fields
}
func NewFieldInterceptorBuilder ¶
func NewFieldInterceptorBuilder() *FieldInterceptorBuilder
func (FieldInterceptorBuilder) Emit ¶
func (p FieldInterceptorBuilder) Emit() *FieldInterceptor
func (*FieldInterceptorBuilder) Name ¶
func (f *FieldInterceptorBuilder) Name(name string) *FieldInterceptorBuilder
func (*FieldInterceptorBuilder) Noinline ¶
func (f *FieldInterceptorBuilder) Noinline(noinline bool) *FieldInterceptorBuilder
type LazyBuilder ¶
type LazyBuilder struct {
// contains filtered or unexported fields
}
func NewLazyBuilder ¶
func NewLazyBuilder() *LazyBuilder
func (LazyBuilder) Emit ¶
func (p LazyBuilder) Emit() *Lazy
func (*LazyBuilder) Ref ¶
func (l *LazyBuilder) Ref(ref bool) *LazyBuilder
type MinimizePadding ¶
type MinimizePadding struct { }
func NewMinimizePadding ¶
func NewMinimizePadding() *MinimizePadding
func (*MinimizePadding) String ¶
func (p *MinimizePadding) String() string
type MinimizePaddingBuilder ¶
type MinimizePaddingBuilder struct {
// contains filtered or unexported fields
}
func NewMinimizePaddingBuilder ¶
func NewMinimizePaddingBuilder() *MinimizePaddingBuilder
func (MinimizePaddingBuilder) Emit ¶
func (p MinimizePaddingBuilder) Emit() *MinimizePadding
type PackIsset ¶
type PackIsset struct {
Atomic bool `thrift:"atomic,1" db:"atomic" json:"atomic"`
}
Attributes:
- Atomic
func NewPackIsset ¶
func NewPackIsset() *PackIsset
type PackIssetBuilder ¶
type PackIssetBuilder struct {
// contains filtered or unexported fields
}
func NewPackIssetBuilder ¶
func NewPackIssetBuilder() *PackIssetBuilder
func (*PackIssetBuilder) Atomic ¶
func (p *PackIssetBuilder) Atomic(atomic bool) *PackIssetBuilder
func (PackIssetBuilder) Emit ¶
func (p PackIssetBuilder) Emit() *PackIsset
type Ref ¶
type Ref struct {
Type RefType `thrift:"type,1" db:"type" json:"type"`
}
Attributes:
- Type
type RefBuilder ¶
type RefBuilder struct {
// contains filtered or unexported fields
}
func NewRefBuilder ¶
func NewRefBuilder() *RefBuilder
func (RefBuilder) Emit ¶
func (p RefBuilder) Emit() *Ref
func (*RefBuilder) Type ¶
func (r *RefBuilder) Type(type_a1 RefType) *RefBuilder
type RefType ¶
type RefType int64
const ( RefType_Unique RefType = 0 )
func RefTypeFromString ¶
func RefTypePtr ¶
type ScopedEnumAsUnionType ¶
type ScopedEnumAsUnionType struct { }
func NewScopedEnumAsUnionType ¶
func NewScopedEnumAsUnionType() *ScopedEnumAsUnionType
func (*ScopedEnumAsUnionType) Read ¶
func (p *ScopedEnumAsUnionType) Read(iprot thrift.Protocol) error
func (*ScopedEnumAsUnionType) String ¶
func (p *ScopedEnumAsUnionType) String() string
type ScopedEnumAsUnionTypeBuilder ¶
type ScopedEnumAsUnionTypeBuilder struct {
// contains filtered or unexported fields
}
func NewScopedEnumAsUnionTypeBuilder ¶
func NewScopedEnumAsUnionTypeBuilder() *ScopedEnumAsUnionTypeBuilder
func (ScopedEnumAsUnionTypeBuilder) Emit ¶
func (p ScopedEnumAsUnionTypeBuilder) Emit() *ScopedEnumAsUnionType
type StrongType ¶
type StrongType struct { }
Indicates a typedef should be 'strong', and require an explicit cast to the underlying type.
Currently only works for integer typedefs, for example:
@cpp.StrongType typedef i32 MyId;
Will cause an enum class to be used instead of a typedef in the genearte code, for example:
enum class MyId : ::std::int32_t {};
func NewStrongType ¶
func NewStrongType() *StrongType
func (*StrongType) String ¶
func (p *StrongType) String() string
type StrongTypeBuilder ¶
type StrongTypeBuilder struct {
// contains filtered or unexported fields
}
func NewStrongTypeBuilder ¶
func NewStrongTypeBuilder() *StrongTypeBuilder
func (StrongTypeBuilder) Emit ¶
func (p StrongTypeBuilder) Emit() *StrongType
type TriviallyRelocatable ¶
type TriviallyRelocatable struct { }
func NewTriviallyRelocatable ¶
func NewTriviallyRelocatable() *TriviallyRelocatable
func (*TriviallyRelocatable) Read ¶
func (p *TriviallyRelocatable) Read(iprot thrift.Protocol) error
func (*TriviallyRelocatable) String ¶
func (p *TriviallyRelocatable) String() string
type TriviallyRelocatableBuilder ¶
type TriviallyRelocatableBuilder struct {
// contains filtered or unexported fields
}
func NewTriviallyRelocatableBuilder ¶
func NewTriviallyRelocatableBuilder() *TriviallyRelocatableBuilder
func (TriviallyRelocatableBuilder) Emit ¶
func (p TriviallyRelocatableBuilder) Emit() *TriviallyRelocatable
type UseOpEncode ¶
type UseOpEncode struct { }
func NewUseOpEncode ¶
func NewUseOpEncode() *UseOpEncode
func (*UseOpEncode) String ¶
func (p *UseOpEncode) String() string
type UseOpEncodeBuilder ¶
type UseOpEncodeBuilder struct {
// contains filtered or unexported fields
}
func NewUseOpEncodeBuilder ¶
func NewUseOpEncodeBuilder() *UseOpEncodeBuilder
func (UseOpEncodeBuilder) Emit ¶
func (p UseOpEncodeBuilder) Emit() *UseOpEncode