schema

package
v1.23.0 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChildOf

type ChildOf struct {
	ParentTable      string
	ParentTableField string
}

func NewChildOf

func NewChildOf(childOf string) (*ChildOf, error)

type Column

type Column struct {
	Name            string
	ForeignKey      *ForeignKey
	FieldDescriptor protoreflect.FieldDescriptor
	IsPrimaryKey    bool
	IsUnique        bool
	IsRepeated      bool
	IsExtension     bool
	IsMessage       bool
	IsOptional      bool
	Nested          *Table
	Message         string
	ConvertTo       *v1.StringConvertion
}

func NewColumn

func NewColumn(d protoreflect.FieldDescriptor, fieldInfo *v1.Column, ordinal int, inlineDepth int) (*Column, error)

func (*Column) QuotedName

func (c *Column) QuotedName() string

type ForeignKey

type ForeignKey struct {
	Table      string
	TableField string
}

func NewForeignKey

func NewForeignKey(foreignKey string) (*ForeignKey, error)

type PrimaryKey

type PrimaryKey struct {
	Name            string
	FieldDescriptor protoreflect.FieldDescriptor
	Index           int
}

type Schema

type Schema struct {
	Name          string
	TableRegistry map[string]*Table
	// contains filtered or unexported fields
}

func NewSchema

func NewSchema(name string, rootMessageDescriptor protoreflect.MessageDescriptor, withProtoOption bool, logger *zap.Logger) (*Schema, error)

func (*Schema) ChangeName

func (s *Schema) ChangeName(name string) error

func (*Schema) String

func (s *Schema) String() string

type Table

type Table struct {
	Name        string
	PrimaryKey  *PrimaryKey
	ChildOf     *ChildOf
	Columns     []*Column
	Ordinal     int
	InlineDepth int
	PbTableInfo *pbSchmema.Table
}

func NewTable

func NewTable(descriptor protoreflect.MessageDescriptor, tableInfo *pbSchmema.Table, ordinal int, inlineDepth int) (*Table, error)

func (*Table) ColumnByFieldName

func (t *Table) ColumnByFieldName(fieldName string) *Column

ColumnByFieldName returns the column matching the given protobuf field name, or nil if not found.

Jump to

Keyboard shortcuts

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