specs

package module
v0.0.0-...-539b765 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2021 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const AssetDebug = false

AssetDebug is true if the assets were built with the debug flag enabled.

Variables

View Source
var (
	ParsedFeatures   Features
	ParsedPairs      Pairs
	ParsedInfos      Infos
	ParsedOperations Operations
)

Functions

func Asset

func Asset(name string) ([]byte, error)

Asset loads and returns the asset for the given name. It returns an error if the asset could not be found or could not be loaded.

func AssetDigest

func AssetDigest(name string) ([sha256.Size]byte, error)

AssetDigest returns the digest of the file with the given name. It returns an error if the asset could not be found or the digest could not be loaded.

func AssetDir

func AssetDir(name string) ([]string, error)

AssetDir returns the file names below a certain directory embedded in the file by go-bindata. For example if you run go-bindata on data/... and data contains the following hierarchy:

data/
  foo.txt
  img/
    a.png
    b.png

then AssetDir("data") would return []string{"foo.txt", "img"}, AssetDir("data/img") would return []string{"a.png", "b.png"}, AssetDir("foo.txt") and AssetDir("notexist") would return an error, and AssetDir("") will return []string{"data"}.

func AssetInfo

func AssetInfo(name string) (os.FileInfo, error)

AssetInfo loads and returns the asset info for the given name. It returns an error if the asset could not be found or could not be loaded.

func AssetNames

func AssetNames() []string

AssetNames returns the names of the assets.

func AssetString

func AssetString(name string) (string, error)

AssetString returns the asset contents as a string (instead of a []byte).

func Digests

func Digests() (map[string][sha256.Size]byte, error)

Digests returns a map of all known files and their checksums.

func MustAsset

func MustAsset(name string) []byte

MustAsset is like Asset but panics when Asset would return an error. It simplifies safe initialization of global variables.

func MustAssetString

func MustAssetString(name string) string

MustAssetString is like AssetString but panics when Asset would return an error. It simplifies safe initialization of global variables.

func RestoreAsset

func RestoreAsset(dir, name string) error

RestoreAsset restores an asset under the given directory.

func RestoreAssets

func RestoreAssets(dir, name string) error

RestoreAssets restores an asset under the given directory recursively.

Types

type Feature

type Feature struct {
	Name        string
	Description string
}

type Features

type Features []Feature

Features is all global features that available.

Features will be defined in features.toml.

func (Features) Sort

func (p Features) Sort()

type Field

type Field struct {
	Name string
	Type string
}

Field is the spec for field.

type Info

type Info struct {
	Scope       string
	Category    string
	Name        string
	Type        string
	Export      bool
	Description string
}

Info is the spec for info.

type Infos

type Infos []Info

Infos is the spec for infos.

func (Infos) Sort

func (p Infos) Sort()

Sort will sort the pair spec.

type Interface

type Interface struct {
	Name        string
	Description string
	Ops         []Operation
}

Interface is the spec for interface.

type Namespace

type Namespace struct {
	Name      string
	Features  []string // The feature names that provided by current namespace.
	Implement []string
	New       New
	Op        []Op
}

Namespace is the data parsed from TOML.

func (*Namespace) Sort

func (n *Namespace) Sort()

Sort will sort the Namespace

type New

type New struct {
	Required []string
	Optional []string
}

New is the spec for new function.

func (*New) Sort

func (o *New) Sort()

Sort will sort the New

type Op

type Op struct {
	Name string

	Required []string
	Optional []string
}

Op means an operation definition.

func (*Op) Sort

func (o *Op) Sort()

Sort will sort the Op

type Operation

type Operation struct {
	Name        string
	Description string
	Params      []string
	Pairs       []string
	Results     []string
	ObjectMode  string
	Local       bool
}

Operation is the spec for operation.

type Operations

type Operations struct {
	Interfaces []Interface
	Fields     []Field
}

Operations is the spec for operations.

func (*Operations) Sort

func (o *Operations) Sort()

Sort will sort the Operations

type Pair

type Pair struct {
	Name        string
	Type        string
	Description string
}

Pair is the data parsed from TOML.

type Pairs

type Pairs []Pair

func (Pairs) Sort

func (p Pairs) Sort()

Sort will sort the pair spec.

type Service

type Service struct {
	Name       string
	Namespaces []Namespace
	Pairs      Pairs
	Infos      Infos
}

Service is the data parsed from TOML.

func ParseService

func ParseService(filePath string) (Service, error)

func (*Service) Sort

func (s *Service) Sort()

Sort will sort the service spec.

Jump to

Keyboard shortcuts

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