cursor

package
v0.0.0-...-ee86543 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2021 License: MIT Imports: 10 Imported by: 0

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

Constants

This section is empty.

Variables

View Source
var ErrFailedToFindCursor = errors.New("import cursor package")

ErrFailedToFindCursor reports that github.com/tdakkota/cursor import failed.

Functions

This section is empty.

Types

type DeriveBinary

type DeriveBinary struct {
	Serialize   macro.Handler
	Deserialize macro.Handler
}

DeriveBinary is a deriving macro which generates binary (de)serialization implementations using github.com/tdakkota/cursor.

func Create

func Create() (*DeriveBinary, error)

Create creates new DeriveBinary instance.

func (*DeriveBinary) Handle

func (d *DeriveBinary) Handle(ctxt macro.Context, node ast.Node) error

Handle implements macro.Handler.

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.

func (*Deserialize) Callback

func (m *Deserialize) Callback(d *derive.Derive, typeSpec *ast.TypeSpec) error

Callback implements derive.Protocol.

func (*Deserialize) Impl

func (m *Deserialize) Impl(d *derive.Derive, field derive.Field) (*ast.BlockStmt, error)

Impl 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.

func (*Serialize) Callback

func (m *Serialize) Callback(d *derive.Derive, typeSpec *ast.TypeSpec) error

Callback implements derive.Protocol.

func (*Serialize) Impl

func (m *Serialize) Impl(d *derive.Derive, field derive.Field) (*ast.BlockStmt, error)

Impl implements derive.Protocol.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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