declarations

package
v0.0.0-...-59d4d0b Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2023 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

DeclarationMap is a mapping of Declaration Type to the Go type

View Source
var ErrUnknownDeclarationType = errors.New("unknown declaration type")

Functions

func GenerateFromGit

func GenerateFromGit(repoURL, commit, path string, reps replace.Replacements, output string) error

GenerateFromGit generates Go types from the declarative schema at the git repo/commit/path using the optional replacements and outputs it at the given directory

Types

type Declaration

type Declaration struct {
	// A string uniquely identifying this declaration.
	Identifier string `json:"Identifier" required:"true"`

	// A unique token generated by the server specifying a particular revision
	ServerToken string `json:"ServerToken,omitempty"`

	// The payload describing this declaration.
	Payload DeclarationPayload `json:"Payload" required:"true"`
}

func NewFromType

func NewFromType(typ, id, token string) (*Declaration, error)

func (*Declaration) MarshalJSON

func (d *Declaration) MarshalJSON() ([]byte, error)

func (*Declaration) Type

func (d *Declaration) Type() string

type DeclarationPayload

type DeclarationPayload interface {
	DeclarationType() string
}

type EncodeOption

type EncodeOption func(*Encoder)

func WithReplacements

func WithReplacements(reps replace.Replacements) EncodeOption

type Encoder

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

func NewEncoder

func NewEncoder(f *jen.File, opts ...EncodeOption) *Encoder

func (*Encoder) Encode

func (e *Encoder) Encode(schemas ...*schema.Schema) []byte

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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