info

package
v0.4.4 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2021 License: MIT Imports: 4 Imported by: 0

README

fbshelper/info

introduction

this is simple program getting flatbuffers data infomation.

usage


	fileOpt := info.Option{
		Maps: []info.OptionType{
			info.OptionType{
				Key:  "file_id",
				Size: 8,
			},
			info.OptionType{
				Key:  "name",
				Size: 0,
			},
			info.OptionType{
				Key:  "index_at",
				Size: 8,
			},
		},
    }
    fileOpt := info.Option{
		Maps: []info.OptionType{
			info.OptionType{
				Key:  "version",
				Size: 4,
			},
			info.OptionType{
				Key:  "index_type",
				Size: 1,
			},
			info.OptionType{
				Key:  "index",
				Size: -1,
				Nest: fileOpt,
			},
		},
    }
    
    var buf byte[]
    //... reading fbs encoded data to buf

    fbsInfo := info.GetFbsRootInfo(buf, fileOpt)

    fmt.Printf("data length=%d\n", fbsInfo.Length)

Authorization code grant

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ENABLE_LOG_DEBUG bool = false

Functions

func Debugf

func Debugf(f string, args ...interface{})

func MaxLen

func MaxLen(x, y uint32) uint32

Types

type Fbs

type Fbs struct {
	Top     uint32
	VOffset uint32
	VPos    uint32
	Length  uint32

	SOffset uint32
	SPos    uint32
	SLen    uint32
	VLen    uint16
	TLen    uint16
	VTable  []uint16
	Table   []uint64
	Nest    map[int]uint32
	Childs  map[int]*Fbs

	Vector map[int]bool // ?
}

func GetFbsInfo

func GetFbsInfo(buf []byte, top uint32, opt Option) *Fbs

func GetFbsRootInfo

func GetFbsRootInfo(buf []byte, opt Option) *Fbs

func (*Fbs) FetchAll

func (info *Fbs) FetchAll(buf []byte, opt Option) error

func (*Fbs) FetchTable

func (info *Fbs) FetchTable(buf []byte, opt Option) error

func (*Fbs) FetchVtable

func (info *Fbs) FetchVtable(buf []byte, opt Option) error

type FieldType

type FieldType byte
const (
	FIELD_ONE FieldType = iota
	FIELD_TWO
	FIELD_FOUR
	FIELD_EIGHT
	FIELD_STRING
	FIELD_NEST
	FIELD_VECTOR
)

func GetFieldType

func GetFieldType(otype OptionType) FieldType

type Option

type Option struct {
	Maps []OptionType
}

type OptionType

type OptionType struct {
	Key      string
	Size     int
	IsVector bool
	Nest     Option
}

Jump to

Keyboard shortcuts

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