package example

import "git.sr.ht/~sircmpwn/go-bare/example"

Index

Package Files

schema.go time.go

type Address

type Address struct {
    Address [4]string `bare:"address"`
    City    string    `bare:"city"`
    State   string    `bare:"state"`
    Country string    `bare:"country"`
}

func (*Address) Decode

func (t *Address) Decode(data []byte) error

func (*Address) Encode

func (t *Address) Encode() ([]byte, error)

type Customer

type Customer struct {
    Name    string  `bare:"name"`
    Email   string  `bare:"email"`
    Address Address `bare:"address"`
    Orders  []struct {
        OrderId  int64 `bare:"orderId"`
        Quantity int32 `bare:"quantity"`
    }   `bare:"orders"`
    Metadata map[string][]byte `bare:"metadata"`
}

func (*Customer) Decode

func (t *Customer) Decode(data []byte) error

func (*Customer) Encode

func (t *Customer) Encode() ([]byte, error)

func (Customer) IsUnion

func (_ Customer) IsUnion()

type Department

type Department uint
const (
    ACCOUNTING       Department = 0
    ADMINISTRATION   Department = 1
    CUSTOMER_SERVICE Department = 2
    DEVELOPMENT      Department = 3
    JSMITH           Department = 99
)

func (Department) String

func (t Department) String() string

type Employee

type Employee struct {
    Name       string            `bare:"name"`
    Email      string            `bare:"email"`
    Address    Address           `bare:"address"`
    Department Department        `bare:"department"`
    HireDate   Time              `bare:"hireDate"`
    PublicKey  *PublicKey        `bare:"publicKey"`
    Metadata   map[string][]byte `bare:"metadata"`
}

func (*Employee) Decode

func (t *Employee) Decode(data []byte) error

func (*Employee) Encode

func (t *Employee) Encode() ([]byte, error)

func (Employee) IsUnion

func (_ Employee) IsUnion()

type Person

type Person interface {
    bare.Union
}

type PublicKey

type PublicKey [128]byte

func (*PublicKey) Decode

func (t *PublicKey) Decode(data []byte) error

func (*PublicKey) Encode

func (t *PublicKey) Encode() ([]byte, error)

type TerminatedEmployee

type TerminatedEmployee struct{}

func (*TerminatedEmployee) Decode

func (t *TerminatedEmployee) Decode(data []byte) error

func (*TerminatedEmployee) Encode

func (t *TerminatedEmployee) Encode() ([]byte, error)

func (TerminatedEmployee) IsUnion

func (_ TerminatedEmployee) IsUnion()

type Time

type Time time.Time

func (*Time) Unmarshal

func (t *Time) Unmarshal(r *bare.Reader) error

Directories

PathSynopsis
example/basic
example/stream

Package example imports 4 packages (graph).

Version v0.0.0-20210406120253-ab86bc2846d9 (latest) | Published Apr 6, 2021 | Platform: linux/amd64 | Updated 1 month ago

.
Tools for package owners.