jschema

package
v0.1.1 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: 17 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type JSchema

type JSchema struct {
	File  *fs.File
	Inner *ischema.ISchema

	Rules map[string]schema.Rule

	UsedUserTypes_ *StringSet // TODO private

	LenOnce     sync.ErrOnceWithValue[uint]
	LoadOnce    sync.ErrOnce
	CompileOnce sync.ErrOnce

	ASTNode                  schema.ASTNode
	AreKeysOptionalByDefault bool
}

func FromFile

func FromFile(f *fs.File, oo ...Option) *JSchema

FromFile creates a Jsight schema from file.

func New

func New[T bytes.Byter](name string, content T, oo ...Option) *JSchema

New creates a Jsight schema with specified name and content.

func (*JSchema) AddRule

func (s *JSchema) AddRule(n string, r schema.Rule) error

func (*JSchema) AddType

func (s *JSchema) AddType(name string, sc schema.Schema) (err error)

func (*JSchema) AddUserTypeName

func (s *JSchema) AddUserTypeName(name string)

func (*JSchema) BuildASTNode

func (s *JSchema) BuildASTNode() schema.ASTNode

func (*JSchema) Check

func (s *JSchema) Check() (err error)

func (*JSchema) CollectUserTypes

func (s *JSchema) CollectUserTypes()

func (*JSchema) Compile

func (s *JSchema) Compile() error

func (*JSchema) Example

func (s *JSchema) Example() (b []byte, err error)

func (*JSchema) GetAST

func (s *JSchema) GetAST() (an schema.ASTNode, err error)

func (*JSchema) InnerTypesList

func (s *JSchema) InnerTypesList() map[string]ischema.Type

func (*JSchema) Len

func (s *JSchema) Len() (uint, error)

func (*JSchema) UsedUserTypes

func (s *JSchema) UsedUserTypes() ([]string, error)

type Option

type Option func(s *JSchema)

type StringSet

type StringSet struct {
	// contains filtered or unexported fields
}

StringSet a set of strings. gen:Set

func NewStringSet

func NewStringSet(vv ...string) *StringSet

func (*StringSet) Add

func (m *StringSet) Add(v string)

Add adds specific value to set.

func (*StringSet) Data

func (m *StringSet) Data() []string

Data return set's data.

func (*StringSet) Has

func (m *StringSet) Has(v string) bool

Has checks that specified value is exists.

func (*StringSet) Len

func (m *StringSet) Len() int

Len returns len of set.

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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