modelfromproto

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2022 License: MPL-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 Alias

type Alias interface {
	ApplyToColumn(column *Column)
	ApplyToTable(table *Table)
}

func ChangeColumn

func ChangeColumn(column *Column) Alias

func ChangeName

func ChangeName(name string) Alias

type CollapsedOptions

type CollapsedOptions struct {
	Paths         []string
	IgnoredFields map[string]struct{}
	Aliases       map[string]Alias
}

func NewCollapsedOptions

func NewCollapsedOptions(opts []Option) CollapsedOptions

type Column

type Column struct {
	Name            string
	Description     string
	Type            string
	Resolver        string
	CreationOptions *CreationOptions
}

type CreationOptions

type CreationOptions struct {
	Nullable string
	Unique   string
}

type File

type File struct {
	Table     *Table
	Relations []*Table
}

func ResourceFileFromProto

func ResourceFileFromProto(service, resource, pathToProto string, opts ...Option) (*File, error)

type OneOfer

type OneOfer interface {
	GetOneOf() *desc.OneOfDescriptor
}

type Option

type Option interface {
	Apply(co *CollapsedOptions)
}

func WithAlias

func WithAlias(path string, alias Alias) Option

func WithIgnored

func WithIgnored(ignoredFields ...string) Option

func WithProtoPaths

func WithProtoPaths(paths ...string) Option

type Table

type Table struct {
	// Should be in camel case
	Service      string
	Resource     string
	AbsolutePath []string
	RelativePath []string

	Multiplex string

	Columns   []*Column
	Relations []*Table

	Alias string
}

type TableBuilder

type TableBuilder struct {
	Service      string
	Resource     string
	AbsolutePath string
	RelativePath string
	Multiplex    string

	MessageDesc *desc.MessageDescriptor

	IgnoredFields map[string]struct{}
	Aliases       map[string]Alias

	Field  *expandedField
	Parent *TableBuilder
}

func (*TableBuilder) Build

func (tb *TableBuilder) Build() (*Table, error)

func (*TableBuilder) WithMessageFromProto

func (tb *TableBuilder) WithMessageFromProto(messageName, pathToProto string, paths ...string) error

type UnimplementedAlias

type UnimplementedAlias struct{}

func (UnimplementedAlias) ApplyToColumn

func (u UnimplementedAlias) ApplyToColumn(*Column)

func (UnimplementedAlias) ApplyToTable

func (u UnimplementedAlias) ApplyToTable(*Table)

Jump to

Keyboard shortcuts

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