index

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseWSOptionIndex added in v0.3.0

func ParseWSOptionIndex(md protoreflect.MessageDescriptor) ([]*Index, []*Index)

parse worksheet option index

Types

type Index

type Index struct {
	Cols       []string // column names in CamelCase (single-column or multi-column)
	Name       string   // index name in CamelCase
	SortedCols []string // sorted column names in CamelCase (single-column or multi-column)
}

func (*Index) String

func (index *Index) String() string

type IndexDescriptor

type IndexDescriptor struct {
	LevelMessage *LevelMessage // message hierarchy to the deepest level message which contains all index fields.
}

type LevelField

type LevelField struct {
	FD protoreflect.FieldDescriptor // index field descriptor

	// leveled fd list
	// For example, if you have a message described as below and created an index on "PathUserID"
	// fds are ["path", "user", "id"]
	//
	// message ItemConf {
	// 	option (tableau.worksheet) = {
	// 	  name: "ItemConf"
	// 	  index: "PathUserID"
	// 	};
	// 	map<uint32, Item> item_map = 1 [(tableau.field) = { key: "ID" layout: LAYOUT_VERTICAL }];
	// 	message Item {
	// 	  uint32 id = 1 [(tableau.field) = { name: "ID" }];
	// 	  Path path = 2 [(tableau.field) = { name: "Path" }];
	// 	  message Path {
	// 	    string dir = 1 [(tableau.field) = { name: "Dir" }];
	// 	    User user = 2 [(tableau.field) = { name: "User" }];
	// 	    message User {
	// 	      uint32 id = 1 [(tableau.field) = { name: "ID" }];
	// 	    }
	// 	  }
	// 	}
	// }
	LeveledFDList []protoreflect.FieldDescriptor
}

type LevelIndex added in v0.3.0

type LevelIndex struct {
	*Index
	MD              protoreflect.MessageDescriptor
	ColFields       []*LevelField
	SortedColFields []*LevelField
	NameConflict    *Index
}

func (*LevelIndex) Name added in v0.3.0

func (l *LevelIndex) Name() string

type LevelMessage

type LevelMessage struct {
	NextLevel *LevelMessage

	// Current level message's field which contains index fields.
	// Only valid when NextLevel is not nil.
	FD protoreflect.FieldDescriptor

	// Current level message's all index fields
	Indexes, OrderedIndexes []*LevelIndex

	// depth of message hierarchy
	Depth, MapDepth int
}

namespaced level info

func (*LevelMessage) NeedGenIndex added in v0.5.0

func (l *LevelMessage) NeedGenIndex() bool

func (*LevelMessage) NeedGenOrderedIndex added in v0.5.0

func (l *LevelMessage) NeedGenOrderedIndex() bool

Jump to

Keyboard shortcuts

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