schema

package
v1.14.0-dev.1 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const BOOT_INSTALL = "$boot_install"

Variables

This section is empty.

Functions

func CreateOrUpdateSchema

func CreateOrUpdateSchema(info *Info) error

func DeleteSchema

func DeleteSchema(schemaType def.SchemaType, name string) error

func GetAllForType

func GetAllForType(schemaType def.SchemaType) ([]string, error)

func GetAllSchema

func GetAllSchema() map[string]string

func GetAllSchemaStatus

func GetAllSchemaStatus() map[string]string

func GetSchemaInstallScript

func GetSchemaInstallScript(key string) (string, string)

func ImportSchema

func ImportSchema(schema map[string]string) map[string]string

func InferCustom

func InferCustom(schemaFile string, messageName string) (ast.StreamFields, error)

func InferFromSchemaFile

func InferFromSchemaFile(schemaType string, schemaId string) (ast.StreamFields, error)

func InferProtobuf

func InferProtobuf(schemaFile string, messageName string) (ast.StreamFields, error)

InferProtobuf infers the schema from a protobuf file dynamically in case the schema file changed

func InitRegistry

func InitRegistry() error

InitRegistry initialize the registry, only called once by the server

func Register

func Register(info *Info) error

func SchemaPartialImport

func SchemaPartialImport(schemas map[string]string) map[string]string

SchemaPartialImport compare the schema to be installed and the one in database if not exist in database, install; if existed, ignore

func UninstallAllSchema

func UninstallAllSchema()

Types

type Files

type Files struct {
	SchemaFile string
	SoFile     string
}

func GetSchemaFile

func GetSchemaFile(schemaType def.SchemaType, name string) (*Files, error)

type Info

type Info struct {
	Type     def.SchemaType `json:"type"`
	Name     string         `json:"name"`
	Content  string         `json:"content"`
	FilePath string         `json:"file"`
	SoPath   string         `json:"soFile"`
}

func GetSchema

func GetSchema(schemaType def.SchemaType, name string) (*Info, error)

func (*Info) InstallScript

func (i *Info) InstallScript() string

func (*Info) Validate

func (i *Info) Validate() error

type Registry

type Registry struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Registry is a global registry for schemas It stores the schema ids and the ref to its file content in memory The schema definition is stored in the file system and will only be loaded once used

Jump to

Keyboard shortcuts

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