structure

package
v0.0.0-...-326cea8 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IdTypeInt64Int32   = VIdTypeType(0) // <int64, int32>
	IdTypeStringString = VIdTypeType(3) // <string, string>
)
View Source
const (
	VtxIdKey   = "id"
	VtxTypeKey = "type"
	// 下列常量只在返回给客户端列式协议时使用
	ClientProtoEdgeTypeKey       = "bg__to_client_edge_type"
	ClientProtoEdgeStartVIdKey   = "bg__to_client_start_v_id"
	ClientProtoEdgeStartVTypeKey = "bg__to_client_start_v_type"
	ClientProtoVtxIdKey          = "bg__to_client_vtx_id"   // 边终点id或点id
	ClientProtoVtxTypeKey        = "bg__to_client_vtx_type" // 边终点type或点type
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Bool

type Bool bool

func (Bool) BindTo

func (b Bool) BindTo(dest interface{}) error

func (Bool) EncodeTo

func (b Bool) EncodeTo(w *protocol.BigEndianWriter)

func (Bool) Eq

func (b Bool) Eq(other Element, strict bool) bool

func (Bool) String

func (b Bool) String() string

func (Bool) Tp

func (Bool) Tp() ElementType

type CoreDataType

type CoreDataType byte
const (
	TrueType   CoreDataType = 1
	FalseType  CoreDataType = 2
	Int32Type  CoreDataType = 3
	Int64Type  CoreDataType = 4
	FloatType  CoreDataType = 5
	DoubleType CoreDataType = 6
	StringType CoreDataType = 7

	VertexType CoreDataType = 8
	PathType   CoreDataType = 9

	// the relative location of these three fields should be synced with DirectionType
	ForwardEdgeType CoreDataType = 10
	ReverseEdgeType CoreDataType = 11
	DoubleEdgeType  CoreDataType = 12

	ListType     CoreDataType = 13
	MapType      CoreDataType = 14
	PropertyType CoreDataType = 15

	VertexWithPropertiesType      CoreDataType = 16
	ForwardEdgeWithPropertiesType CoreDataType = 17
	ReverseEdgeWithPropertiesType CoreDataType = 18
	DoubleEdgeWithPropertiesType  CoreDataType = 19

	SVertexType               CoreDataType = 24
	SVertexWithPropertiesType CoreDataType = 25

	ForwardSEdgeType               CoreDataType = 26
	ReverseSEdgeType               CoreDataType = 27
	DoubleSEdgeType                CoreDataType = 28
	ForwardSEdgeWithPropertiesType CoreDataType = 29
	ReverseSEdgeWithPropertiesType CoreDataType = 30
	DoubleSEdgeWithPropertiesType  CoreDataType = 31
	LinkedMapType                  CoreDataType = 32

	ColumnarBinType CoreDataType = 40
	// ValueType 用于到客户端的列式协议中,客户端识别反序列化成Property还是具体的Int32、Double等类型
	ValueType CoreDataType = 41
)

type DirectionType

type DirectionType int32
const (
	DirectionType_Forward DirectionType = 1
	DirectionType_Reverse DirectionType = 2
	DirectionType_Double  DirectionType = 3
)

type Edge

type Edge struct {
	OutV       *Vertex
	InV        *Vertex
	Type       string
	Properties []*Property
}

func (*Edge) BindTo

func (e *Edge) BindTo(dest interface{}) error

func (*Edge) EncodeTo

func (e *Edge) EncodeTo(w *protocol.BigEndianWriter)

func (*Edge) Eq

func (e *Edge) Eq(other Element, strict bool) bool

func (*Edge) String

func (e *Edge) String() string

func (*Edge) Tp

func (*Edge) Tp() ElementType

type Element

type Element interface {
	Tp() ElementType
	// Eq and sortString methods are for internal usage, used in test case.
	Eq(Element, bool) bool

	String() string
	EncodeTo(w *protocol.BigEndianWriter)
	BindTo(dest interface{}) error
	// contains filtered or unexported methods
}

func Decode

func Decode(w *protocol.BigEndianReader) (Element, error)

func DecodeEx

func DecodeEx(w *protocol.BigEndianReader, useStruct bool) (Element, error)

type ElementType

type ElementType int64
const (
	VERTEX ElementType = iota
	EDGE
	PATH
	PROPERTY
	BOOL
	INT32
	INT64
	FLOAT32
	FLOAT64
	STRING
	BYTES
	LIST
	MAP
	// These three types are not in the data type protocol with server side,
	// start from 1024 should be enough for future new server types.
	PATH_STRUCT = 1024
	LIST_STRUCT = 1025
	MAP_STRUCT  = 1026
	LINKEDMAP   = 1027
)

type Extra

type Extra struct {
	Cost int64
}

type Float32

type Float32 float32

func (Float32) BindTo

func (f32 Float32) BindTo(dest interface{}) error

func (Float32) EncodeTo

func (f32 Float32) EncodeTo(w *protocol.BigEndianWriter)

func (Float32) Eq

func (f32 Float32) Eq(other Element, strict bool) bool

func (Float32) String

func (f32 Float32) String() string

func (Float32) Tp

func (Float32) Tp() ElementType

type Float64

type Float64 float64

func (Float64) BindTo

func (f64 Float64) BindTo(dest interface{}) error

func (Float64) EncodeTo

func (f64 Float64) EncodeTo(w *protocol.BigEndianWriter)

func (Float64) Eq

func (f64 Float64) Eq(other Element, strict bool) bool

func (Float64) String

func (f64 Float64) String() string

func (Float64) Tp

func (Float64) Tp() ElementType

type Int32

type Int32 int32

func (Int32) BindTo

func (i32 Int32) BindTo(dest interface{}) error

func (Int32) EncodeTo

func (i32 Int32) EncodeTo(w *protocol.BigEndianWriter)

func (Int32) Eq

func (i32 Int32) Eq(other Element, strict bool) bool

func (Int32) String

func (i32 Int32) String() string

func (Int32) Tp

func (Int32) Tp() ElementType

type Int64

type Int64 int64

func (Int64) BindTo

func (i64 Int64) BindTo(dest interface{}) error

func (Int64) EncodeTo

func (i64 Int64) EncodeTo(w *protocol.BigEndianWriter)

func (Int64) Eq

func (i64 Int64) Eq(other Element, strict bool) bool

func (Int64) String

func (i64 Int64) String() string

func (Int64) Tp

func (Int64) Tp() ElementType

type LinkedMap

type LinkedMap struct {
	Elems map[Element]Element
	Keys  []Element
}

func (LinkedMap) BindTo

func (lm LinkedMap) BindTo(dest interface{}) error

func (LinkedMap) EncodeTo

func (lm LinkedMap) EncodeTo(w *protocol.BigEndianWriter)

func (LinkedMap) Eq

func (lm LinkedMap) Eq(other Element, strict bool) bool

func (LinkedMap) String

func (lm LinkedMap) String() string

func (LinkedMap) Tp

func (LinkedMap) Tp() ElementType

type List

type List []Element

func (List) BindTo

func (l List) BindTo(dest interface{}) error

BindTo dest is slice or struct

func (List) EncodeTo

func (l List) EncodeTo(w *protocol.BigEndianWriter)

func (List) Eq

func (l List) Eq(other Element, strict bool) bool

func (List) String

func (l List) String() string

List is used as bulkset

func (List) Tp

func (List) Tp() ElementType

type ListStruct

type ListStruct struct {
	Elems []Element
}

func (ListStruct) BindTo

func (ls ListStruct) BindTo(dest interface{}) error

func (ListStruct) EncodeTo

func (ls ListStruct) EncodeTo(w *protocol.BigEndianWriter)

func (ListStruct) Eq

func (ls ListStruct) Eq(other Element, strict bool) bool

func (ListStruct) String

func (ls ListStruct) String() string

List is used as bulkset

func (ListStruct) Tp

func (ListStruct) Tp() ElementType

type Map

type Map map[Element]Element

func (Map) BindTo

func (m Map) BindTo(dest interface{}) error

BindTo dest must be &struct

func (Map) EncodeTo

func (m Map) EncodeTo(w *protocol.BigEndianWriter)

func (Map) Eq

func (m Map) Eq(other Element, strict bool) bool

func (Map) String

func (m Map) String() string

func (Map) Tp

func (Map) Tp() ElementType

type MapStruct

type MapStruct struct {
	Elems map[Element]Element
}

func (MapStruct) BindTo

func (ms MapStruct) BindTo(dest interface{}) error

func (MapStruct) EncodeTo

func (ms MapStruct) EncodeTo(w *protocol.BigEndianWriter)

func (MapStruct) Eq

func (ms MapStruct) Eq(other Element, strict bool) bool

func (MapStruct) String

func (ms MapStruct) String() string

func (MapStruct) Tp

func (MapStruct) Tp() ElementType

type Path

type Path []Element

TODO(huyingqian): support Label

func (Path) BindTo

func (p Path) BindTo(dest interface{}) error

func (Path) EncodeTo

func (p Path) EncodeTo(w *protocol.BigEndianWriter)

func (Path) Eq

func (p Path) Eq(other Element, strict bool) bool

func (Path) String

func (p Path) String() string

func (Path) Tp

func (Path) Tp() ElementType

type PathStruct

type PathStruct struct {
	Elems []Element
}

func (PathStruct) BindTo

func (ps PathStruct) BindTo(dest interface{}) error

func (PathStruct) EncodeTo

func (ps PathStruct) EncodeTo(w *protocol.BigEndianWriter)

func (PathStruct) Eq

func (ps PathStruct) Eq(other Element, strict bool) bool

func (PathStruct) String

func (ps PathStruct) String() string

func (PathStruct) Tp

func (PathStruct) Tp() ElementType

type Property

type Property struct {
	Key   string
	Value interface{}
}

func (Property) BindTo

func (p Property) BindTo(dest interface{}) error

func (*Property) EncodeTo

func (p *Property) EncodeTo(w *protocol.BigEndianWriter)

func (*Property) Eq

func (p *Property) Eq(other Element, strict bool) bool

func (*Property) String

func (p *Property) String() string

func (*Property) Tp

func (*Property) Tp() ElementType

type String

type String string

func (String) BindTo

func (s String) BindTo(dest interface{}) error

func (String) EncodeTo

func (s String) EncodeTo(w *protocol.BigEndianWriter)

func (String) Eq

func (s String) Eq(other Element, strict bool) bool

func (String) String

func (s String) String() string

func (String) Tp

func (String) Tp() ElementType

type VIdTypeType

type VIdTypeType int8

type Vertex

type Vertex struct {
	Id    int64
	Type  int32
	VType VIdTypeType
	SId   string
	SType string
	// vertex property will not be automatically retrieved with vertex
	Properties []*Property
}

func (*Vertex) BindTo

func (v *Vertex) BindTo(dest interface{}) error

BindTo 暂不支持带Properties的绑定

func (*Vertex) EncodeTo

func (v *Vertex) EncodeTo(w *protocol.BigEndianWriter)

func (*Vertex) Eq

func (v *Vertex) Eq(other Element, strict bool) bool

func (*Vertex) SimpleString

func (v *Vertex) SimpleString() string

SimpleString return vertex string as vertex(id,type), eg vertex(1,2)

func (*Vertex) String

func (v *Vertex) String() string

func (*Vertex) Tp

func (v *Vertex) Tp() ElementType

Jump to

Keyboard shortcuts

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