schema

package
v1.0.0-beta.13 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2022 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrIncompatibleSchema = fmt.Errorf("error incompatible schema")
	ErrExpectedString     = fmt.Errorf("expected string type")
	ErrExpectedNumber     = fmt.Errorf("expected json.Number")
	ErrUnsupportedType    = fmt.Errorf("unsupported type")
)
View Source
var (
	ErrUnsupportedFormat = fmt.Errorf("unsupported format. supported formats are: JSON, TypeScripts, Go, Java")
)

Functions

func Infer

func Infer(sch *schema.Schema, name string, docs []json.RawMessage, primaryKey []string, autoGenerate []string,
	depth int,
) error

func ScaffoldFromDB

func ScaffoldFromDB(db string, collections []*api.CollectionDescription, lang string) error

Types

type Collection

type Collection struct {
	Name      string
	NameDecap string
	JSON      string
}

type Field

type Field struct {
	Type      string
	TypeDecap string

	Name       string
	NameDecap  string
	NameSnake  string
	NameJSON   string
	NamePlural string

	IsArray  bool
	IsObject bool

	AutoGenerate    bool
	PrimaryKeyIdx   int
	ArrayDimensions int

	Description string
}

type JSONToGo

type JSONToGo struct{}

func (*JSONToGo) GetFooterTemplate

func (*JSONToGo) GetFooterTemplate() string

func (*JSONToGo) GetHeaderTemplate

func (*JSONToGo) GetHeaderTemplate() string

func (*JSONToGo) HasTime

func (*JSONToGo) HasTime(schema string) bool

func (*JSONToGo) HasUUID

func (*JSONToGo) HasUUID(schema string) bool

type JSONToJava

type JSONToJava struct{}

func (*JSONToJava) GetFooterTemplate

func (*JSONToJava) GetFooterTemplate() string

func (*JSONToJava) GetHeaderTemplate

func (*JSONToJava) GetHeaderTemplate() string

func (*JSONToJava) HasTime

func (*JSONToJava) HasTime(schema string) bool

func (*JSONToJava) HasUUID

func (*JSONToJava) HasUUID(schema string) bool

type JSONToLangType

type JSONToLangType interface {
	GetHeaderTemplate() string
	GetFooterTemplate() string
	HasTime(string) bool
	HasUUID(string) bool
}

type JSONToTypeScript

type JSONToTypeScript struct{}

func (*JSONToTypeScript) GetFooterTemplate

func (*JSONToTypeScript) GetFooterTemplate() string

func (*JSONToTypeScript) GetHeaderTemplate

func (*JSONToTypeScript) GetHeaderTemplate() string

func (*JSONToTypeScript) HasTime

func (*JSONToTypeScript) HasTime(schema string) bool

func (*JSONToTypeScript) HasUUID

func (*JSONToTypeScript) HasUUID(schema string) bool

type Object

type Object struct {
	Name      string
	NameDecap string
	NameSnake string
	NameJSON  string

	NamePlural string

	Description string

	Nested bool

	Fields []Field
}

Jump to

Keyboard shortcuts

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