Documentation ¶
Index ¶
Constants ¶
View Source
const ( // String type. String = types.String // Bool type. Bool = types.Bool // Int type. Int = types.Int // Int8 type. Int8 = types.Int8 // Int16 type. Int16 = types.Int16 // Int32 type. Int32 = types.Int32 // Int64 type. Int64 = types.Int64 // Uint type. Uint = types.Uint // Uint8 type. Uint8 = types.Uint8 // Uint16 type. Uint16 = types.Uint16 // Uint32 type. Uint32 = types.Uint32 // Uint64 type. Uint64 = types.Uint64 // Uintptr type. Uintptr = types.Uintptr // Float32 type. Float32 = types.Float32 // Float64 type. Float64 = types.Float64 )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Array ¶
Array type of fixed size.
type Basic ¶
Basic type.
type Bytes ¶
type Bytes struct {
TypeName string
}
Bytes is a special type for []byte.
type Constraint ¶
type Constraint interface { // BeforeRead returns whether the constraint should be checked before // reading the content. This is only applicable to slices and strings. BeforeRead() bool // Validator generates the code to validate the receiver with the current // constraint. Validator(recv string) string }
Constraint to be checked on a struct field.
type Map ¶
Map type.
type Maybe ¶
Maybe is a type whose value can not be present.
type Options ¶
type Options struct { // Path of the package in which the type is located. Path string // Types to generate encoder and decoder for. Types []string // Recvs are the receiver names for the generated methods. Recvs []string }
Options to configure generation.
type Slice ¶
Slice type.
type Struct ¶
type Struct struct {
Fields []StructField
}
Struct type.
type StructField ¶
type StructField struct { Name string Type Type Constraints []Constraint }
StructField is a field in a struct.
type Type ¶
type Type interface { // Decoder generates a decoder for the type. recv is the variable or // struct field the data will be decoded into. // If root is true, it means the decoder is being generated for a recv // itself. Decoder(recv string, root bool, constraints ...Constraint) string // Encoder generates an encoder for the type. recv is the variable or // struct field that will be encoded. Encoder(recv string) string }
Type can generate decoders and encoders for a given type.
Click to show internal directories.
Click to hide internal directories.