kiwi

package module
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2021 License: MIT Imports: 6 Imported by: 0

README

go-kiwi

go library for kiwi

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MarshalText

func MarshalText(data uint32, set map[uint32]string) ([]byte, error)

MarshalText Marshall 实现 Deprecated: Marshal should use String instead (or additionally).

func ReadBinarySchema

func ReadBinarySchema(path string, bb *ByteBuffer) error

ReadBinarySchema 读取 .bkiwi 文件

func UnmarshalText

func UnmarshalText(bytes []byte, set map[string]uint32) (uint32, error)

UnmarshalText Unmarshal 实现 Deprecated: Unmarshal will make flag index invalid.

Types

type BinarySchema

type BinarySchema struct {
	// contains filtered or unexported fields
}

BinarySchema parsed from binary kiwi file

func (*BinarySchema) FindDefinition

func (bs *BinarySchema) FindDefinition(definition string, index *uint32) bool

FindDefinition find if the given definition is exist.

func (*BinarySchema) Parse

func (bs *BinarySchema) Parse(bb *ByteBuffer) bool

Parse parse a binary kiwi file from buffer

func (*BinarySchema) SkipField

func (bs *BinarySchema) SkipField(bb *ByteBuffer, definition uint32, field uint32) bool

SkipField check whether the field should be skipped.

type ByteBuffer

type ByteBuffer struct {
	// contains filtered or unexported fields
}

ByteBuffer a wrapper of bytes.Buffer for more Origin Function of bytes.Buffer, see origin_wrapper.go

func NewByteBuffer added in v1.0.1

func NewByteBuffer(buf []byte) *ByteBuffer

NewByteBuffer new a ByteBuffer with a customized buffer. use new(ByteBuffer) instead, with a default blank buffer.

func (*ByteBuffer) Bytes added in v1.0.4

func (bb *ByteBuffer) Bytes() []byte

Bytes get bytes data

func (*ByteBuffer) OriginRead added in v1.0.4

func (bb *ByteBuffer) OriginRead(value []byte) (n int, err error)

OriginRead bytes.Buffer.Read

func (*ByteBuffer) OriginReadByte added in v1.0.4

func (bb *ByteBuffer) OriginReadByte() (b byte, err error)

OriginReadByte bytes.Buffer.ReadByte

func (*ByteBuffer) OriginReadBytes added in v1.0.4

func (bb *ByteBuffer) OriginReadBytes(delim byte) (line []byte, err error)

OriginReadBytes bytes.Buffer.ReadBytes

func (*ByteBuffer) OriginReadRune added in v1.0.4

func (bb *ByteBuffer) OriginReadRune() (r rune, size int, err error)

OriginReadRune bytes.Buffer.ReadRune

func (*ByteBuffer) OriginReadString added in v1.0.4

func (bb *ByteBuffer) OriginReadString(delim byte) (line string, err error)

OriginReadString bytes.Buffer.ReadString

func (*ByteBuffer) OriginWrite added in v1.0.4

func (bb *ByteBuffer) OriginWrite(value []byte) (n int, err error)

OriginWrite bytes.Buffer.Write

func (*ByteBuffer) OriginWriteByte added in v1.0.4

func (bb *ByteBuffer) OriginWriteByte(value byte) (err error)

OriginWriteByte bytes.Buffer.WriteByte

func (*ByteBuffer) OriginWriteRune added in v1.0.4

func (bb *ByteBuffer) OriginWriteRune(value rune) (n int, err error)

OriginWriteRune bytes.Buffer.WriteRune

func (*ByteBuffer) OriginWriteString added in v1.0.4

func (bb *ByteBuffer) OriginWriteString(value string) (n int, err error)

OriginWriteString bytes.Buffer.WriteString

func (*ByteBuffer) ReadByteB

func (bb *ByteBuffer) ReadByteB(result *bool) bool

ReadByteB read single byte of type bool

func (*ByteBuffer) ReadByteC

func (bb *ByteBuffer) ReadByteC(result *byte) bool

ReadByteC read single byte of type byte

func (*ByteBuffer) ReadString

func (bb *ByteBuffer) ReadString(result *string) bool

ReadString read string data with \x00 tail

func (*ByteBuffer) ReadVarFloat

func (bb *ByteBuffer) ReadVarFloat(result *float32) bool

ReadVarFloat read float32 data with VarFloat encode

func (*ByteBuffer) ReadVarInt

func (bb *ByteBuffer) ReadVarInt(result *int32) bool

ReadVarInt read int32 data with VarInts encode

func (*ByteBuffer) ReadVarUint

func (bb *ByteBuffer) ReadVarUint(result *uint32) bool

ReadVarUint read uint32 data with VarInts encode

func (*ByteBuffer) Reset

func (bb *ByteBuffer) Reset()

Reset reset buffer before reuse

func (*ByteBuffer) WriteByteB

func (bb *ByteBuffer) WriteByteB(value bool)

WriteByteB write single byte of type bool

func (*ByteBuffer) WriteByteC

func (bb *ByteBuffer) WriteByteC(value byte)

WriteByteC write single byte of type byte

func (*ByteBuffer) WriteString

func (bb *ByteBuffer) WriteString(value string)

WriteString write string data with \x00 tail

func (*ByteBuffer) WriteVarFloat

func (bb *ByteBuffer) WriteVarFloat(value float32)

WriteVarFloat write float32 data with VarFloat encode

func (*ByteBuffer) WriteVarInt

func (bb *ByteBuffer) WriteVarInt(value int32)

WriteVarInt write int32 data with VarInts encode

func (*ByteBuffer) WriteVarUint

func (bb *ByteBuffer) WriteVarUint(value uint32)

WriteVarUint write uint32 data with VarInts encode

type Definition

type Definition struct {
	// contains filtered or unexported fields
}

Definition description of schema structure

type Field

type Field struct {
	// contains filtered or unexported fields
}

Field description of schema field

type SchemaKind

type SchemaKind uint8

SchemaKind definition kind in kiwi

const (
	//Enum Uint32 with a restricted set of values that are identified by name.
	//New fields can be added to any MESSAGE while maintaining backwards compatibility.
	Enum SchemaKind = 0
	//Struct Compound value with a fixed set of fields that are always required and written out in order.
	//New fields cannot be added to a struct once that struct is in use.
	Struct SchemaKind = 1
	//Message Compound value with optional fields.
	//New fields can be added to any message while maintaining backwards compatibility.
	Message SchemaKind = 2
)

type SchemaType

type SchemaType int32

SchemaType filed type in kiwi

const (
	//Bool bool
	Bool SchemaType = -1
	//Byte byte
	Byte SchemaType = -2
	//Int int32
	Int SchemaType = -3
	//Uint uint32
	Uint SchemaType = -4
	//Float float32
	Float SchemaType = -5
	//String string
	String SchemaType = -6
)

Directories

Path Synopsis
test
v0
v1
v2

Jump to

Keyboard shortcuts

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