schemahcl

package
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2022 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Marshal returns the Atlas HCL encoding of v.
	Marshal = schemaspec.MarshalerFunc(New().MarshalSpec)
)
View Source
var (
	// Unmarshal parses the Atlas HCL-encoded data and stores the result in the target.
	Unmarshal = schemaspec.UnmarshalerFunc(New().UnmarshalSpec)
)

Functions

func New added in v0.2.0

func New(opts ...Option) *state

New returns a state configured with options.

Types

type Config added in v0.2.0

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

Config configures an unmarshaling.

type Option added in v0.2.0

type Option func(*Config)

Option configures a Config.

func WithScopedEnums added in v0.3.4

func WithScopedEnums(path string, enums ...string) Option

WithScopedEnums configured a list of allowed ENUMs to be used in the given context, block or attribute. For example, the following option allows setting HASH or BTREE to the "using" attribute in "index" block.

WithScopedEnums("table.index.type", "HASH", "BTREE")

table "t" {
	...
	index "i" {
		type = HASH     // Allowed.
		type = INVALID  // Not Allowed.
	}
}

func WithTypes added in v0.2.0

func WithTypes(typeSpecs []*schemaspec.TypeSpec) Option

WithTypes configures the list of given types as identifiers in the unmarshaling context.

Jump to

Keyboard shortcuts

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