schema

package
v2.4.0-beta.3 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2026 License: Apache-2.0 Imports: 21 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 string, name string) error

func GetAllForType

func GetAllForType(schemaType string) ([]string, error)

func GetAllSchema

func GetAllSchema() map[string]string

func GetAllSchemaStatus

func GetAllSchemaStatus() map[string]string

func GetSchemaFile

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

GetSchemaFile return main schema file if schema id is defined; otherwise return the original schema id (possibly the file path)

func GetSchemaInstallScript

func GetSchemaInstallScript(key string) (string, string)

func ImportSchema

func ImportSchema(ctx context.Context, schema map[string]string) map[string]string

func InferFromSchemaFile

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

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(ctx context.Context, 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 CustomType added in v2.3.0

type CustomType struct{}

func (*CustomType) Infer added in v2.3.0

func (c *CustomType) Infer(logger api.Logger, schemaId string, _ string) (ast.StreamFields, error)

func (*CustomType) Scan added in v2.3.0

func (c *CustomType) Scan(logger api.Logger, schemaDir string) (map[string]*modules.Files, error)

type Info

type Info struct {
	Type     string `json:"type" yaml:"type"`
	Name     string `json:"name" yaml:"name"`
	Content  string `json:"content,omitempty" yaml:"content,omitempty"`
	FilePath string `json:"file,omitempty" yaml:"filePath,omitempty"`
	SoPath   string `json:"soFile,omitempty" yaml:"soPath,omitempty"`
	Version  string `json:"version,omitempty" yaml:"version,omitempty"`
}

func GetSchema

func GetSchema(schemaType string, name string) (*Info, error)

func (*Info) InstallScript

func (i *Info) InstallScript() string

func (*Info) Validate

func (i *Info) Validate() error

type PbType added in v2.3.0

type PbType struct{}

func (*PbType) Infer added in v2.3.0

func (p *PbType) Infer(_ api.Logger, filePath string, messageId string) (ast.StreamFields, error)

func (*PbType) Scan added in v2.3.0

func (p *PbType) Scan(logger api.Logger, schemaDir string) (map[string]*modules.Files, error)

type Registry

type Registry struct {
	syncx.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