schemahcl

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2021 License: Apache-2.0 Imports: 13 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(func(v interface{}) ([]byte, error) {
		r := &schemaspec.Resource{}
		if err := r.Scan(v); err != nil {
			return nil, fmt.Errorf("schemahcl: failed scanning %T to resource: %w", v, err)
		}
		return encode(r)
	})
)
View Source
var (
	// Unmarshal parses the Atlas HCL-encoded data and stores the result in the target.
	Unmarshal = schemaspec.UnmarshalerFunc(func(data []byte, v interface{}) error {
		spec, err := decode(data)
		if err != nil {
			return fmt.Errorf("schemahcl: failed decoding: %w", err)
		}
		if err := spec.As(v); err != nil {
			return fmt.Errorf("schemahcl: failed reading spec as %T: %w", v, err)
		}
		return nil
	})
)

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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