gobe

command module
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2023 License: MIT Imports: 17 Imported by: 0

README

Go Binary Encoding

Code Generation based Go Type Serialization Library

Note: GOBE is still under active development.

Note: Circular reference is not supported.

Usage

buffer := make([]byte, obj.SizeGOBE())
obj.MarshalGOBE(buffer)

Installation

go install github.com/lemon-mint/gobe@latest

Tagged Union

type MyEnum struct {
    Type Type
    A    *A `gobe_enum:"Type=AType"`
    B    *B `gobe_enum:"Type=BType"`
    C    *C `gobe_enum:"Type=CType"`
}

Ignored Field

type MyStruct struct {
    Name    string
    Health  CustomUint8
    Weapons []Weapon
    Conns   []net.Conn `gobe:"-"` // ignored
}

Custom Marshaler/Unmarshaler

type GOBE_CUSTOM_TYPE interface {
    ZZMarshalGOBE(dst []byte) uint64
    ZZUnmarshalGOBE(src []byte) (offset uint64, ok bool)
    ZZSizeGOBE() uint64
}

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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