Documentation ¶
Overview ¶
Package cursor contains derive_binary macro. This macro derives cursor.Scanner/cursor.Appender interfaces to implement binary serialization using https://github.com/tdakkota/cursor
Index ¶
- Variables
- type DeriveBinary
- type Deserialize
- func (m *Deserialize) Array(d *derive.Derive, field derive.Field, arr derive.Array) (*ast.BlockStmt, error)
- func (m *Deserialize) CallFor(d *derive.Derive, field derive.Field, kind types.BasicKind) (*ast.BlockStmt, error)
- func (m *Deserialize) Callback(d *derive.Derive, typeSpec *ast.TypeSpec) error
- func (m *Deserialize) Impl(d *derive.Derive, field derive.Field) (*ast.BlockStmt, error)
- type Serialize
- func (m *Serialize) Array(d *derive.Derive, field derive.Field, arr derive.Array) (*ast.BlockStmt, error)
- func (m *Serialize) CallFor(d *derive.Derive, field derive.Field, kind types.BasicKind) (*ast.BlockStmt, error)
- func (m *Serialize) Callback(d *derive.Derive, typeSpec *ast.TypeSpec) error
- func (m *Serialize) Impl(d *derive.Derive, field derive.Field) (*ast.BlockStmt, error)
Constants ¶
This section is empty.
Variables ¶
var ErrFailedToFindCursor = errors.New("import cursor package")
ErrFailedToFindCursor reports that github.com/tdakkota/cursor import failed.
Functions ¶
This section is empty.
Types ¶
type DeriveBinary ¶
DeriveBinary is a deriving macro which generates binary (de)serialization implementations using github.com/tdakkota/cursor.
type Deserialize ¶
type Deserialize struct{}
Deserialize defines derive.Protocol for binary deserialization.
func (*Deserialize) Array ¶
func (m *Deserialize) Array(d *derive.Derive, field derive.Field, arr derive.Array) (*ast.BlockStmt, error)
Array implements derive.ArrayDerive.
func (*Deserialize) CallFor ¶
func (m *Deserialize) CallFor(d *derive.Derive, field derive.Field, kind types.BasicKind) (*ast.BlockStmt, error)
CallFor implements derive.Protocol.
type Serialize ¶
type Serialize struct{}
Serialize defines derive.Protocol for binary serialization.
func (*Serialize) Array ¶
func (m *Serialize) Array(d *derive.Derive, field derive.Field, arr derive.Array) (*ast.BlockStmt, error)
Array implements derive.ArrayDerive.
func (*Serialize) CallFor ¶
func (m *Serialize) CallFor(d *derive.Derive, field derive.Field, kind types.BasicKind) (*ast.BlockStmt, error)
CallFor implements derive.Protocol.