gometa

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2024 License: LGPL-2.1 Imports: 11 Imported by: 0

README

molecule/gometa

In molecule, a table and its associated actions build up an atom. Atoms and relationships between them build up a molecule. While traditional REST acts on individual table, molecule acts on whole RDB across all tables.

A molecule could be also represented by protocol buffer, called Graph:

https://github.com/genelet/molecule/blob/master/gometa/meta.proto

This package implements 2 functions to translate Molecule to Graph, and Graph to Molecule.



Chapter 1. Oneof

oneof is a powerful message type in protobuf, yet it is not associated with any native GO type. In this package, we assign oneof to a list of table columns. If table has mutiple oneof, they will be represented by a map, in which key is the name of oneof and value its list of columns.

map[string][]string

For whole database which contains many tables, all the oneofs are represented by

map[tableName][string][]string



Chapter 2. Functions

2.1 Graph to Molecule
func GraphToMolecule(graph *Graph) (*godbi.Molecule, map[string]map[string][]string) {

It translates Graph to Molecule and the associated oneofs in map[string]map[string][]string.


2.2 Molecule to Graph
func MoleculeToGraph(molecule *godbi.Molecule, args ...interface{}) *Graph

where args are

  • oneofs in the database: map[atomName][oneofName][]string
  • package name
  • goPackage name
  • primary table name
  • primary table's pk
  • child to parent table mapping
  • table name to pk mapping

2.3 Errors

Matchings between protobuf fields to table columns have to be unique, hence, there is no ambiguity in the functions. Every error should be panic and be fixed in the package.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Node_Actions_ConnectType_name = map[int32]string{
		0: "CONNECTDefault",
		1: "CONNECTOne",
		2: "CONNECTArray",
		3: "CONNECTMap",
		4: "CONNECTMany",
	}
	Node_Actions_ConnectType_value = map[string]int32{
		"CONNECTDefault": 0,
		"CONNECTOne":     1,
		"CONNECTArray":   2,
		"CONNECTMap":     3,
		"CONNECTMany":    4,
	}
)

Enum value maps for Node_Actions_ConnectType.

View Source
var File_proto_meta_proto protoreflect.FileDescriptor

Functions

func GraphToMolecule

func GraphToMolecule(graph *Graph) (*godbi.Molecule, map[string]map[string][]string)

GraphToMolecule translates protobuf message into molecule with possible oneof map

oneof format: map[atomName][oneofName][list of fields]

func MapToProtobuf added in v1.0.7

func MapToProtobuf(item map[string]interface{}, pb proto.Message) error

MapToProtobuf converts an item, which is a map, returned from REST to protobuf pb.

func MapsToProtobufs added in v1.0.7

func MapsToProtobufs(lists []interface{}, pb proto.Message) ([]proto.Message, error)

MapsToProtobufs converts multiple items returned from REST to a slice of protobuf defined in pb.

func ProtobufToMap added in v1.0.7

func ProtobufToMap(pb proto.Message) (map[string]interface{}, error)

Types

type Graph

type Graph struct {
	PackageName   string            `protobuf:"bytes,1,opt,name=packageName,proto3" json:"packageName,omitempty"`
	GoPackageName string            `protobuf:"bytes,2,opt,name=goPackageName,proto3" json:"goPackageName,omitempty"`
	DBDriver      int32             `protobuf:"varint,3,opt,name=dBDriver,proto3" json:"dBDriver,omitempty"`
	PkTable       string            `protobuf:"bytes,4,opt,name=pkTable,proto3" json:"pkTable,omitempty"`
	PkName        string            `protobuf:"bytes,5,opt,name=pkName,proto3" json:"pkName,omitempty"`
	PksTable      map[string]string `` /* 157-byte string literal not displayed */
	Pks           map[string]string `` /* 147-byte string literal not displayed */
	Nodes         []*Node           `protobuf:"bytes,8,rep,name=nodes,proto3" json:"nodes,omitempty"`
	// contains filtered or unexported fields
}

Graph

func MoleculeToGraph

func MoleculeToGraph(molecule *godbi.Molecule, args ...interface{}) *Graph

MoleculeToGraph translates molecule into protobuf. args:

  • oneofs format: map[atomName][oneofName][list of fields]
  • package name
  • goPackage name
  • primary table name
  • primary table's pk
  • child to parent table mapping
  • table name to pk mapping

func (*Graph) Descriptor deprecated

func (*Graph) Descriptor() ([]byte, []int)

Deprecated: Use Graph.ProtoReflect.Descriptor instead.

func (*Graph) GetDBDriver added in v1.1.2

func (x *Graph) GetDBDriver() int32

func (*Graph) GetGoPackageName added in v1.1.2

func (x *Graph) GetGoPackageName() string

func (*Graph) GetNodes

func (x *Graph) GetNodes() []*Node

func (*Graph) GetPackageName

func (x *Graph) GetPackageName() string

func (*Graph) GetPkName added in v1.0.9

func (x *Graph) GetPkName() string

func (*Graph) GetPkTable added in v1.1.0

func (x *Graph) GetPkTable() string

func (*Graph) GetPks added in v1.1.0

func (x *Graph) GetPks() map[string]string

func (*Graph) GetPksTable added in v1.1.0

func (x *Graph) GetPksTable() map[string]string

func (*Graph) ProtoMessage

func (*Graph) ProtoMessage()

func (*Graph) ProtoReflect

func (x *Graph) ProtoReflect() protoreflect.Message

func (*Graph) Reset

func (x *Graph) Reset()

func (*Graph) String

func (x *Graph) String() string

type Node

type Node struct {
	AtomName    string        `protobuf:"bytes,1,opt,name=atomName,proto3" json:"atomName,omitempty"`
	AtomTable   *Node_Table   `protobuf:"bytes,2,opt,name=atomTable,proto3" json:"atomTable,omitempty"`
	AtomActions *Node_Actions `protobuf:"bytes,3,opt,name=atomActions,proto3" json:"atomActions,omitempty"`
	// contains filtered or unexported fields
}

func (*Node) Descriptor deprecated

func (*Node) Descriptor() ([]byte, []int)

Deprecated: Use Node.ProtoReflect.Descriptor instead.

func (*Node) GetAtomActions

func (x *Node) GetAtomActions() *Node_Actions

func (*Node) GetAtomName added in v1.3.0

func (x *Node) GetAtomName() string

func (*Node) GetAtomTable

func (x *Node) GetAtomTable() *Node_Table

func (*Node) ProtoMessage

func (*Node) ProtoMessage()

func (*Node) ProtoReflect

func (x *Node) ProtoReflect() protoreflect.Message

func (*Node) Reset

func (x *Node) Reset()

func (*Node) String

func (x *Node) String() string

type Node_Actions

type Node_Actions struct {
	InsertItem *Node_Actions_Insert `protobuf:"bytes,7,opt,name=insertItem,proto3" json:"insertItem,omitempty"`
	UpdateItem *Node_Actions_Update `protobuf:"bytes,9,opt,name=updateItem,proto3" json:"updateItem,omitempty"`
	InsupdItem *Node_Actions_Insupd `protobuf:"bytes,10,opt,name=insupdItem,proto3" json:"insupdItem,omitempty"`
	DeleteItem *Node_Actions_Delete `protobuf:"bytes,12,opt,name=deleteItem,proto3" json:"deleteItem,omitempty"`
	DelecsItem *Node_Actions_Delecs `protobuf:"bytes,13,opt,name=delecsItem,proto3" json:"delecsItem,omitempty"`
	EditItem   *Node_Actions_Edit   `protobuf:"bytes,14,opt,name=editItem,proto3" json:"editItem,omitempty"`
	TopicsItem *Node_Actions_Topics `protobuf:"bytes,15,opt,name=topicsItem,proto3" json:"topicsItem,omitempty"`
	// contains filtered or unexported fields
}

func (*Node_Actions) Descriptor deprecated

func (*Node_Actions) Descriptor() ([]byte, []int)

Deprecated: Use Node_Actions.ProtoReflect.Descriptor instead.

func (*Node_Actions) GetDelecsItem

func (x *Node_Actions) GetDelecsItem() *Node_Actions_Delecs

func (*Node_Actions) GetDeleteItem

func (x *Node_Actions) GetDeleteItem() *Node_Actions_Delete

func (*Node_Actions) GetEditItem

func (x *Node_Actions) GetEditItem() *Node_Actions_Edit

func (*Node_Actions) GetInsertItem

func (x *Node_Actions) GetInsertItem() *Node_Actions_Insert

func (*Node_Actions) GetInsupdItem

func (x *Node_Actions) GetInsupdItem() *Node_Actions_Insupd

func (*Node_Actions) GetTopicsItem

func (x *Node_Actions) GetTopicsItem() *Node_Actions_Topics

func (*Node_Actions) GetUpdateItem

func (x *Node_Actions) GetUpdateItem() *Node_Actions_Update

func (*Node_Actions) ProtoMessage

func (*Node_Actions) ProtoMessage()

func (*Node_Actions) ProtoReflect

func (x *Node_Actions) ProtoReflect() protoreflect.Message

func (*Node_Actions) Reset

func (x *Node_Actions) Reset()

func (*Node_Actions) String

func (x *Node_Actions) String() string

type Node_Actions_ConnectType

type Node_Actions_ConnectType int32
const (
	Node_Actions_CONNECTDefault Node_Actions_ConnectType = 0
	Node_Actions_CONNECTOne     Node_Actions_ConnectType = 1
	Node_Actions_CONNECTArray   Node_Actions_ConnectType = 2
	Node_Actions_CONNECTMap     Node_Actions_ConnectType = 3
	Node_Actions_CONNECTMany    Node_Actions_ConnectType = 4
)

func (Node_Actions_ConnectType) Descriptor

func (Node_Actions_ConnectType) Enum

func (Node_Actions_ConnectType) EnumDescriptor deprecated

func (Node_Actions_ConnectType) EnumDescriptor() ([]byte, []int)

Deprecated: Use Node_Actions_ConnectType.Descriptor instead.

func (Node_Actions_ConnectType) Number

func (Node_Actions_ConnectType) String

func (x Node_Actions_ConnectType) String() string

func (Node_Actions_ConnectType) Type

type Node_Actions_Connection

type Node_Actions_Connection struct {
	AtomName    string                   `protobuf:"bytes,1,opt,name=atomName,proto3" json:"atomName,omitempty"`
	ActionName  string                   `protobuf:"bytes,2,opt,name=actionName,proto3" json:"actionName,omitempty"`
	RelateArgs  map[string]string        `` /* 161-byte string literal not displayed */
	RelateExtra map[string]string        `` /* 163-byte string literal not displayed */
	Marker      string                   `protobuf:"bytes,5,opt,name=marker,proto3" json:"marker,omitempty"`
	Dimension   Node_Actions_ConnectType `protobuf:"varint,6,opt,name=dimension,proto3,enum=molecule.Node_Actions_ConnectType" json:"dimension,omitempty"`
	// contains filtered or unexported fields
}

func (*Node_Actions_Connection) Descriptor deprecated

func (*Node_Actions_Connection) Descriptor() ([]byte, []int)

Deprecated: Use Node_Actions_Connection.ProtoReflect.Descriptor instead.

func (*Node_Actions_Connection) GetActionName

func (x *Node_Actions_Connection) GetActionName() string

func (*Node_Actions_Connection) GetAtomName added in v1.3.0

func (x *Node_Actions_Connection) GetAtomName() string

func (*Node_Actions_Connection) GetDimension

func (*Node_Actions_Connection) GetMarker

func (x *Node_Actions_Connection) GetMarker() string

func (*Node_Actions_Connection) GetRelateArgs

func (x *Node_Actions_Connection) GetRelateArgs() map[string]string

func (*Node_Actions_Connection) GetRelateExtra

func (x *Node_Actions_Connection) GetRelateExtra() map[string]string

func (*Node_Actions_Connection) ProtoMessage

func (*Node_Actions_Connection) ProtoMessage()

func (*Node_Actions_Connection) ProtoReflect

func (x *Node_Actions_Connection) ProtoReflect() protoreflect.Message

func (*Node_Actions_Connection) Reset

func (x *Node_Actions_Connection) Reset()

func (*Node_Actions_Connection) String

func (x *Node_Actions_Connection) String() string

type Node_Actions_Delecs

type Node_Actions_Delecs struct {
	ActionName       string                     `protobuf:"bytes,1,opt,name=actionName,proto3" json:"actionName,omitempty"`
	PrepareConnects  []*Node_Actions_Connection `protobuf:"bytes,2,rep,name=prepareConnects,proto3" json:"prepareConnects,omitempty"`
	NextpageConnects []*Node_Actions_Connection `protobuf:"bytes,3,rep,name=nextpageConnects,proto3" json:"nextpageConnects,omitempty"`
	IsDo             bool                       `protobuf:"varint,4,opt,name=isDo,proto3" json:"isDo,omitempty"`
	// contains filtered or unexported fields
}

func (*Node_Actions_Delecs) Descriptor deprecated

func (*Node_Actions_Delecs) Descriptor() ([]byte, []int)

Deprecated: Use Node_Actions_Delecs.ProtoReflect.Descriptor instead.

func (*Node_Actions_Delecs) GetActionName

func (x *Node_Actions_Delecs) GetActionName() string

func (*Node_Actions_Delecs) GetIsDo

func (x *Node_Actions_Delecs) GetIsDo() bool

func (*Node_Actions_Delecs) GetNextpageConnects

func (x *Node_Actions_Delecs) GetNextpageConnects() []*Node_Actions_Connection

func (*Node_Actions_Delecs) GetPrepareConnects

func (x *Node_Actions_Delecs) GetPrepareConnects() []*Node_Actions_Connection

func (*Node_Actions_Delecs) ProtoMessage

func (*Node_Actions_Delecs) ProtoMessage()

func (*Node_Actions_Delecs) ProtoReflect

func (x *Node_Actions_Delecs) ProtoReflect() protoreflect.Message

func (*Node_Actions_Delecs) Reset

func (x *Node_Actions_Delecs) Reset()

func (*Node_Actions_Delecs) String

func (x *Node_Actions_Delecs) String() string

type Node_Actions_Delete

type Node_Actions_Delete struct {
	ActionName       string                     `protobuf:"bytes,1,opt,name=actionName,proto3" json:"actionName,omitempty"`
	PrepareConnects  []*Node_Actions_Connection `protobuf:"bytes,2,rep,name=prepareConnects,proto3" json:"prepareConnects,omitempty"`
	NextpageConnects []*Node_Actions_Connection `protobuf:"bytes,3,rep,name=nextpageConnects,proto3" json:"nextpageConnects,omitempty"`
	IsDo             bool                       `protobuf:"varint,4,opt,name=isDo,proto3" json:"isDo,omitempty"`
	// contains filtered or unexported fields
}

func (*Node_Actions_Delete) Descriptor deprecated

func (*Node_Actions_Delete) Descriptor() ([]byte, []int)

Deprecated: Use Node_Actions_Delete.ProtoReflect.Descriptor instead.

func (*Node_Actions_Delete) GetActionName

func (x *Node_Actions_Delete) GetActionName() string

func (*Node_Actions_Delete) GetIsDo

func (x *Node_Actions_Delete) GetIsDo() bool

func (*Node_Actions_Delete) GetNextpageConnects

func (x *Node_Actions_Delete) GetNextpageConnects() []*Node_Actions_Connection

func (*Node_Actions_Delete) GetPrepareConnects

func (x *Node_Actions_Delete) GetPrepareConnects() []*Node_Actions_Connection

func (*Node_Actions_Delete) ProtoMessage

func (*Node_Actions_Delete) ProtoMessage()

func (*Node_Actions_Delete) ProtoReflect

func (x *Node_Actions_Delete) ProtoReflect() protoreflect.Message

func (*Node_Actions_Delete) Reset

func (x *Node_Actions_Delete) Reset()

func (*Node_Actions_Delete) String

func (x *Node_Actions_Delete) String() string

type Node_Actions_Edit

type Node_Actions_Edit struct {
	ActionName       string                     `protobuf:"bytes,1,opt,name=actionName,proto3" json:"actionName,omitempty"`
	PrepareConnects  []*Node_Actions_Connection `protobuf:"bytes,2,rep,name=prepareConnects,proto3" json:"prepareConnects,omitempty"`
	NextpageConnects []*Node_Actions_Connection `protobuf:"bytes,3,rep,name=nextpageConnects,proto3" json:"nextpageConnects,omitempty"`
	IsDo             bool                       `protobuf:"varint,4,opt,name=isDo,proto3" json:"isDo,omitempty"`
	Picked           []string                   `protobuf:"bytes,7,rep,name=picked,proto3" json:"picked,omitempty"`
	FIELDS           string                     `protobuf:"bytes,15,opt,name=FIELDS,proto3" json:"FIELDS,omitempty"`
	// contains filtered or unexported fields
}

func (*Node_Actions_Edit) Descriptor deprecated

func (*Node_Actions_Edit) Descriptor() ([]byte, []int)

Deprecated: Use Node_Actions_Edit.ProtoReflect.Descriptor instead.

func (*Node_Actions_Edit) GetActionName

func (x *Node_Actions_Edit) GetActionName() string

func (*Node_Actions_Edit) GetFIELDS

func (x *Node_Actions_Edit) GetFIELDS() string

func (*Node_Actions_Edit) GetIsDo

func (x *Node_Actions_Edit) GetIsDo() bool

func (*Node_Actions_Edit) GetNextpageConnects

func (x *Node_Actions_Edit) GetNextpageConnects() []*Node_Actions_Connection

func (*Node_Actions_Edit) GetPicked added in v1.3.0

func (x *Node_Actions_Edit) GetPicked() []string

func (*Node_Actions_Edit) GetPrepareConnects

func (x *Node_Actions_Edit) GetPrepareConnects() []*Node_Actions_Connection

func (*Node_Actions_Edit) ProtoMessage

func (*Node_Actions_Edit) ProtoMessage()

func (*Node_Actions_Edit) ProtoReflect

func (x *Node_Actions_Edit) ProtoReflect() protoreflect.Message

func (*Node_Actions_Edit) Reset

func (x *Node_Actions_Edit) Reset()

func (*Node_Actions_Edit) String

func (x *Node_Actions_Edit) String() string

type Node_Actions_Insert

type Node_Actions_Insert struct {
	ActionName       string                     `protobuf:"bytes,1,opt,name=actionName,proto3" json:"actionName,omitempty"`
	PrepareConnects  []*Node_Actions_Connection `protobuf:"bytes,2,rep,name=prepareConnects,proto3" json:"prepareConnects,omitempty"`
	NextpageConnects []*Node_Actions_Connection `protobuf:"bytes,3,rep,name=nextpageConnects,proto3" json:"nextpageConnects,omitempty"`
	IsDo             bool                       `protobuf:"varint,4,opt,name=isDo,proto3" json:"isDo,omitempty"`
	Picked           []string                   `protobuf:"bytes,7,rep,name=picked,proto3" json:"picked,omitempty"`
	// contains filtered or unexported fields
}

func (*Node_Actions_Insert) Descriptor deprecated

func (*Node_Actions_Insert) Descriptor() ([]byte, []int)

Deprecated: Use Node_Actions_Insert.ProtoReflect.Descriptor instead.

func (*Node_Actions_Insert) GetActionName

func (x *Node_Actions_Insert) GetActionName() string

func (*Node_Actions_Insert) GetIsDo

func (x *Node_Actions_Insert) GetIsDo() bool

func (*Node_Actions_Insert) GetNextpageConnects

func (x *Node_Actions_Insert) GetNextpageConnects() []*Node_Actions_Connection

func (*Node_Actions_Insert) GetPicked added in v1.3.0

func (x *Node_Actions_Insert) GetPicked() []string

func (*Node_Actions_Insert) GetPrepareConnects

func (x *Node_Actions_Insert) GetPrepareConnects() []*Node_Actions_Connection

func (*Node_Actions_Insert) ProtoMessage

func (*Node_Actions_Insert) ProtoMessage()

func (*Node_Actions_Insert) ProtoReflect

func (x *Node_Actions_Insert) ProtoReflect() protoreflect.Message

func (*Node_Actions_Insert) Reset

func (x *Node_Actions_Insert) Reset()

func (*Node_Actions_Insert) String

func (x *Node_Actions_Insert) String() string

type Node_Actions_Insupd

type Node_Actions_Insupd struct {
	ActionName       string                     `protobuf:"bytes,1,opt,name=actionName,proto3" json:"actionName,omitempty"`
	PrepareConnects  []*Node_Actions_Connection `protobuf:"bytes,2,rep,name=prepareConnects,proto3" json:"prepareConnects,omitempty"`
	NextpageConnects []*Node_Actions_Connection `protobuf:"bytes,3,rep,name=nextpageConnects,proto3" json:"nextpageConnects,omitempty"`
	IsDo             bool                       `protobuf:"varint,4,opt,name=isDo,proto3" json:"isDo,omitempty"`
	Picked           []string                   `protobuf:"bytes,7,rep,name=picked,proto3" json:"picked,omitempty"`
	// contains filtered or unexported fields
}

func (*Node_Actions_Insupd) Descriptor deprecated

func (*Node_Actions_Insupd) Descriptor() ([]byte, []int)

Deprecated: Use Node_Actions_Insupd.ProtoReflect.Descriptor instead.

func (*Node_Actions_Insupd) GetActionName

func (x *Node_Actions_Insupd) GetActionName() string

func (*Node_Actions_Insupd) GetIsDo

func (x *Node_Actions_Insupd) GetIsDo() bool

func (*Node_Actions_Insupd) GetNextpageConnects

func (x *Node_Actions_Insupd) GetNextpageConnects() []*Node_Actions_Connection

func (*Node_Actions_Insupd) GetPicked added in v1.3.0

func (x *Node_Actions_Insupd) GetPicked() []string

func (*Node_Actions_Insupd) GetPrepareConnects

func (x *Node_Actions_Insupd) GetPrepareConnects() []*Node_Actions_Connection

func (*Node_Actions_Insupd) ProtoMessage

func (*Node_Actions_Insupd) ProtoMessage()

func (*Node_Actions_Insupd) ProtoReflect

func (x *Node_Actions_Insupd) ProtoReflect() protoreflect.Message

func (*Node_Actions_Insupd) Reset

func (x *Node_Actions_Insupd) Reset()

func (*Node_Actions_Insupd) String

func (x *Node_Actions_Insupd) String() string

type Node_Actions_Joint

type Node_Actions_Joint struct {
	TableName string `protobuf:"bytes,1,opt,name=tableName,proto3" json:"tableName,omitempty"`
	Alias     string `protobuf:"bytes,2,opt,name=alias,proto3" json:"alias,omitempty"`
	JoinType  string `protobuf:"bytes,3,opt,name=joinType,proto3" json:"joinType,omitempty"`
	JoinUsing string `protobuf:"bytes,4,opt,name=joinUsing,proto3" json:"joinUsing,omitempty"`
	JoinOn    string `protobuf:"bytes,5,opt,name=joinOn,proto3" json:"joinOn,omitempty"`
	Sortby    string `protobuf:"bytes,6,opt,name=sortby,proto3" json:"sortby,omitempty"`
	// contains filtered or unexported fields
}

func (*Node_Actions_Joint) Descriptor deprecated

func (*Node_Actions_Joint) Descriptor() ([]byte, []int)

Deprecated: Use Node_Actions_Joint.ProtoReflect.Descriptor instead.

func (*Node_Actions_Joint) GetAlias

func (x *Node_Actions_Joint) GetAlias() string

func (*Node_Actions_Joint) GetJoinOn

func (x *Node_Actions_Joint) GetJoinOn() string

func (*Node_Actions_Joint) GetJoinType

func (x *Node_Actions_Joint) GetJoinType() string

func (*Node_Actions_Joint) GetJoinUsing

func (x *Node_Actions_Joint) GetJoinUsing() string

func (*Node_Actions_Joint) GetSortby

func (x *Node_Actions_Joint) GetSortby() string

func (*Node_Actions_Joint) GetTableName

func (x *Node_Actions_Joint) GetTableName() string

func (*Node_Actions_Joint) ProtoMessage

func (*Node_Actions_Joint) ProtoMessage()

func (*Node_Actions_Joint) ProtoReflect

func (x *Node_Actions_Joint) ProtoReflect() protoreflect.Message

func (*Node_Actions_Joint) Reset

func (x *Node_Actions_Joint) Reset()

func (*Node_Actions_Joint) String

func (x *Node_Actions_Joint) String() string

type Node_Actions_Topics

type Node_Actions_Topics struct {
	ActionName       string                     `protobuf:"bytes,1,opt,name=actionName,proto3" json:"actionName,omitempty"`
	PrepareConnects  []*Node_Actions_Connection `protobuf:"bytes,2,rep,name=prepareConnects,proto3" json:"prepareConnects,omitempty"`
	NextpageConnects []*Node_Actions_Connection `protobuf:"bytes,3,rep,name=nextpageConnects,proto3" json:"nextpageConnects,omitempty"`
	IsDo             bool                       `protobuf:"varint,4,opt,name=isDo,proto3" json:"isDo,omitempty"`
	Picked           []string                   `protobuf:"bytes,7,rep,name=picked,proto3" json:"picked,omitempty"`
	Totalforce       int32                      `protobuf:"varint,8,opt,name=totalforce,proto3" json:"totalforce,omitempty"`
	MAXPAGENO        string                     `protobuf:"bytes,9,opt,name=MAXPAGENO,proto3" json:"MAXPAGENO,omitempty"`
	TOTALNO          string                     `protobuf:"bytes,10,opt,name=TOTALNO,proto3" json:"TOTALNO,omitempty"`
	PAGESIZE         string                     `protobuf:"bytes,11,opt,name=PAGESIZE,proto3" json:"PAGESIZE,omitempty"`
	PAGENO           string                     `protobuf:"bytes,12,opt,name=PAGENO,proto3" json:"PAGENO,omitempty"`
	SORTBY           string                     `protobuf:"bytes,13,opt,name=SORTBY,proto3" json:"SORTBY,omitempty"`
	SORTREVERSE      string                     `protobuf:"bytes,14,opt,name=SORTREVERSE,proto3" json:"SORTREVERSE,omitempty"`
	FIELDS           string                     `protobuf:"bytes,15,opt,name=FIELDS,proto3" json:"FIELDS,omitempty"`
	// contains filtered or unexported fields
}

func (*Node_Actions_Topics) Descriptor deprecated

func (*Node_Actions_Topics) Descriptor() ([]byte, []int)

Deprecated: Use Node_Actions_Topics.ProtoReflect.Descriptor instead.

func (*Node_Actions_Topics) GetActionName

func (x *Node_Actions_Topics) GetActionName() string

func (*Node_Actions_Topics) GetFIELDS

func (x *Node_Actions_Topics) GetFIELDS() string

func (*Node_Actions_Topics) GetIsDo

func (x *Node_Actions_Topics) GetIsDo() bool

func (*Node_Actions_Topics) GetMAXPAGENO

func (x *Node_Actions_Topics) GetMAXPAGENO() string

func (*Node_Actions_Topics) GetNextpageConnects

func (x *Node_Actions_Topics) GetNextpageConnects() []*Node_Actions_Connection

func (*Node_Actions_Topics) GetPAGENO

func (x *Node_Actions_Topics) GetPAGENO() string

func (*Node_Actions_Topics) GetPAGESIZE added in v1.3.0

func (x *Node_Actions_Topics) GetPAGESIZE() string

func (*Node_Actions_Topics) GetPicked added in v1.3.0

func (x *Node_Actions_Topics) GetPicked() []string

func (*Node_Actions_Topics) GetPrepareConnects

func (x *Node_Actions_Topics) GetPrepareConnects() []*Node_Actions_Connection

func (*Node_Actions_Topics) GetSORTBY

func (x *Node_Actions_Topics) GetSORTBY() string

func (*Node_Actions_Topics) GetSORTREVERSE

func (x *Node_Actions_Topics) GetSORTREVERSE() string

func (*Node_Actions_Topics) GetTOTALNO

func (x *Node_Actions_Topics) GetTOTALNO() string

func (*Node_Actions_Topics) GetTotalforce added in v1.3.0

func (x *Node_Actions_Topics) GetTotalforce() int32

func (*Node_Actions_Topics) ProtoMessage

func (*Node_Actions_Topics) ProtoMessage()

func (*Node_Actions_Topics) ProtoReflect

func (x *Node_Actions_Topics) ProtoReflect() protoreflect.Message

func (*Node_Actions_Topics) Reset

func (x *Node_Actions_Topics) Reset()

func (*Node_Actions_Topics) String

func (x *Node_Actions_Topics) String() string

type Node_Actions_Update

type Node_Actions_Update struct {
	ActionName       string                     `protobuf:"bytes,1,opt,name=actionName,proto3" json:"actionName,omitempty"`
	PrepareConnects  []*Node_Actions_Connection `protobuf:"bytes,2,rep,name=prepareConnects,proto3" json:"prepareConnects,omitempty"`
	NextpageConnects []*Node_Actions_Connection `protobuf:"bytes,3,rep,name=nextpageConnects,proto3" json:"nextpageConnects,omitempty"`
	IsDo             bool                       `protobuf:"varint,4,opt,name=isDo,proto3" json:"isDo,omitempty"`
	Empties          []string                   `protobuf:"bytes,5,rep,name=empties,proto3" json:"empties,omitempty"`
	Picked           []string                   `protobuf:"bytes,7,rep,name=picked,proto3" json:"picked,omitempty"`
	// contains filtered or unexported fields
}

func (*Node_Actions_Update) Descriptor deprecated

func (*Node_Actions_Update) Descriptor() ([]byte, []int)

Deprecated: Use Node_Actions_Update.ProtoReflect.Descriptor instead.

func (*Node_Actions_Update) GetActionName

func (x *Node_Actions_Update) GetActionName() string

func (*Node_Actions_Update) GetEmpties

func (x *Node_Actions_Update) GetEmpties() []string

func (*Node_Actions_Update) GetIsDo

func (x *Node_Actions_Update) GetIsDo() bool

func (*Node_Actions_Update) GetNextpageConnects

func (x *Node_Actions_Update) GetNextpageConnects() []*Node_Actions_Connection

func (*Node_Actions_Update) GetPicked added in v1.3.0

func (x *Node_Actions_Update) GetPicked() []string

func (*Node_Actions_Update) GetPrepareConnects

func (x *Node_Actions_Update) GetPrepareConnects() []*Node_Actions_Connection

func (*Node_Actions_Update) ProtoMessage

func (*Node_Actions_Update) ProtoMessage()

func (*Node_Actions_Update) ProtoReflect

func (x *Node_Actions_Update) ProtoReflect() protoreflect.Message

func (*Node_Actions_Update) Reset

func (x *Node_Actions_Update) Reset()

func (*Node_Actions_Update) String

func (x *Node_Actions_Update) String() string

type Node_Table

type Node_Table struct {
	TableName string            `protobuf:"bytes,1,opt,name=tableName,proto3" json:"tableName,omitempty"`
	Columns   []*Node_Table_Col `protobuf:"bytes,2,rep,name=columns,proto3" json:"columns,omitempty"`
	Pks       []string          `protobuf:"bytes,3,rep,name=pks,proto3" json:"pks,omitempty"`
	IdAuto    string            `protobuf:"bytes,4,opt,name=idAuto,proto3" json:"idAuto,omitempty"`
	Fks       []*Node_Table_Fk  `protobuf:"bytes,5,rep,name=fks,proto3" json:"fks,omitempty"`
	Uniques   []string          `protobuf:"bytes,6,rep,name=uniques,proto3" json:"uniques,omitempty"`
	// contains filtered or unexported fields
}

func (*Node_Table) Descriptor deprecated

func (*Node_Table) Descriptor() ([]byte, []int)

Deprecated: Use Node_Table.ProtoReflect.Descriptor instead.

func (*Node_Table) GetColumns

func (x *Node_Table) GetColumns() []*Node_Table_Col

func (*Node_Table) GetFks

func (x *Node_Table) GetFks() []*Node_Table_Fk

func (*Node_Table) GetIdAuto

func (x *Node_Table) GetIdAuto() string

func (*Node_Table) GetPks

func (x *Node_Table) GetPks() []string

func (*Node_Table) GetTableName

func (x *Node_Table) GetTableName() string

func (*Node_Table) GetUniques

func (x *Node_Table) GetUniques() []string

func (*Node_Table) ProtoMessage

func (*Node_Table) ProtoMessage()

func (*Node_Table) ProtoReflect

func (x *Node_Table) ProtoReflect() protoreflect.Message

func (*Node_Table) Reset

func (x *Node_Table) Reset()

func (*Node_Table) String

func (x *Node_Table) String() string

type Node_Table_Col

type Node_Table_Col struct {
	ColumnName string `protobuf:"bytes,1,opt,name=columnName,proto3" json:"columnName,omitempty"`
	TypeName   string `protobuf:"bytes,2,opt,name=typeName,proto3" json:"typeName,omitempty"`
	Label      string `protobuf:"bytes,3,opt,name=label,proto3" json:"label,omitempty"`
	Notnull    bool   `protobuf:"varint,4,opt,name=notnull,proto3" json:"notnull,omitempty"`
	Constraint bool   `protobuf:"varint,5,opt,name=constraint,proto3" json:"constraint,omitempty"`
	Auto       bool   `protobuf:"varint,6,opt,name=auto,proto3" json:"auto,omitempty"`
	Recurse    bool   `protobuf:"varint,7,opt,name=recurse,proto3" json:"recurse,omitempty"`
	InOneof    string `protobuf:"bytes,8,opt,name=inOneof,proto3" json:"inOneof,omitempty"`
	// contains filtered or unexported fields
}

func (*Node_Table_Col) Descriptor deprecated

func (*Node_Table_Col) Descriptor() ([]byte, []int)

Deprecated: Use Node_Table_Col.ProtoReflect.Descriptor instead.

func (*Node_Table_Col) GetAuto

func (x *Node_Table_Col) GetAuto() bool

func (*Node_Table_Col) GetColumnName

func (x *Node_Table_Col) GetColumnName() string

func (*Node_Table_Col) GetConstraint added in v1.3.0

func (x *Node_Table_Col) GetConstraint() bool

func (*Node_Table_Col) GetInOneof

func (x *Node_Table_Col) GetInOneof() string

func (*Node_Table_Col) GetLabel

func (x *Node_Table_Col) GetLabel() string

func (*Node_Table_Col) GetNotnull

func (x *Node_Table_Col) GetNotnull() bool

func (*Node_Table_Col) GetRecurse

func (x *Node_Table_Col) GetRecurse() bool

func (*Node_Table_Col) GetTypeName

func (x *Node_Table_Col) GetTypeName() string

func (*Node_Table_Col) ProtoMessage

func (*Node_Table_Col) ProtoMessage()

func (*Node_Table_Col) ProtoReflect

func (x *Node_Table_Col) ProtoReflect() protoreflect.Message

func (*Node_Table_Col) Reset

func (x *Node_Table_Col) Reset()

func (*Node_Table_Col) String

func (x *Node_Table_Col) String() string

type Node_Table_Fk

type Node_Table_Fk struct {
	FkTable  string `protobuf:"bytes,1,opt,name=fkTable,proto3" json:"fkTable,omitempty"`
	FkColumn string `protobuf:"bytes,2,opt,name=fkColumn,proto3" json:"fkColumn,omitempty"`
	Column   string `protobuf:"bytes,3,opt,name=column,proto3" json:"column,omitempty"`
	// contains filtered or unexported fields
}

func (*Node_Table_Fk) Descriptor deprecated

func (*Node_Table_Fk) Descriptor() ([]byte, []int)

Deprecated: Use Node_Table_Fk.ProtoReflect.Descriptor instead.

func (*Node_Table_Fk) GetColumn

func (x *Node_Table_Fk) GetColumn() string

func (*Node_Table_Fk) GetFkColumn

func (x *Node_Table_Fk) GetFkColumn() string

func (*Node_Table_Fk) GetFkTable

func (x *Node_Table_Fk) GetFkTable() string

func (*Node_Table_Fk) ProtoMessage

func (*Node_Table_Fk) ProtoMessage()

func (*Node_Table_Fk) ProtoReflect

func (x *Node_Table_Fk) ProtoReflect() protoreflect.Message

func (*Node_Table_Fk) Reset

func (x *Node_Table_Fk) Reset()

func (*Node_Table_Fk) String

func (x *Node_Table_Fk) String() string

type Rest added in v1.0.7

type Rest struct {
	*Graph
	// contains filtered or unexported fields
}

Rest handles simple restful actions on Protobuf message, using the engine described by Molecule.

func NewRest added in v1.0.7

func NewRest(graph *Graph) *Rest

func NewRestByte added in v1.1.1

func NewRestByte(bs []byte) (*Rest, error)

func (*Rest) Delete added in v1.0.7

func (self *Rest) Delete(ctx context.Context, db *sql.DB, pb proto.Message, extra ...map[string]interface{}) ([]interface{}, error)

Delete protobuf message from database by the primary key defined in constraint extra.

func (*Rest) List added in v1.0.7

func (self *Rest) List(ctx context.Context, db *sql.DB, pb proto.Message, extra ...map[string]interface{}) ([]interface{}, error)

Search protobuf messages by placeholder's protobuf definition, with optional constraint extra.

func (*Rest) Read added in v1.0.7

func (self *Rest) Read(ctx context.Context, db *sql.DB, pb proto.Message, extra ...map[string]interface{}) ([]interface{}, error)

Get proto message from database by the primary key defined in constraint extra.

func (*Rest) Update added in v1.0.7

func (self *Rest) Update(ctx context.Context, db *sql.DB, pb proto.Message, extra ...map[string]interface{}) ([]interface{}, error)

Update protobuf message in database by the primary key defined in contraint extra.

func (*Rest) Write added in v1.0.7

func (self *Rest) Write(ctx context.Context, db *sql.DB, pb proto.Message, extra ...map[string]interface{}) ([]interface{}, error)

Insert protobuf message into database, with optional input data in extra.

type Restful added in v1.0.8

type Restful interface {
	Write(context.Context, *sql.DB, proto.Message, ...map[string]interface{}) ([]interface{}, error)
	Read(context.Context, *sql.DB, proto.Message, ...map[string]interface{}) ([]interface{}, error)
	List(context.Context, *sql.DB, proto.Message, ...map[string]interface{}) ([]interface{}, error)
	Update(context.Context, *sql.DB, proto.Message, ...map[string]interface{}) ([]interface{}, error)
	Delete(context.Context, *sql.DB, proto.Message, ...map[string]interface{}) ([]interface{}, error)
}

Jump to

Keyboard shortcuts

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