_package

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IndexFileName = "index.json"
	PackageType   = "cti.a.p.app.package.v1.0"
)
View Source
const (
	IndexLockFileName = "index-lock.json"
	IndexLockVersion  = "v1"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Asset

type Asset struct {
	Name  string `json:"name"`
	Value []byte `json:"value"`
}

type Dictionaries

type Dictionaries struct {
	Dictionaries Dictionary `json:"dictionaries"`
}

type Dictionary

type Dictionary map[LangCode]Entry

type Entity

type Entity struct {
	Name string `json:"name"`
	Path string `json:"path"`
}

type Entry

type Entry map[Field]string

func ValidateDictionary

func ValidateDictionary(file *os.File) (Entry, error)

type Field

type Field string

type Index

type Index struct {
	Type                 string      `json:"type"`
	AppCode              string      `json:"app_code"`
	Apis                 []string    `json:"apis,omitempty"`
	Entities             []string    `json:"entities,omitempty"`
	Assets               []string    `json:"assets,omitempty"`
	Dictionaries         []string    `json:"dictionaries,omitempty"`
	Depends              []string    `json:"depends,omitempty"`
	Examples             []string    `json:"examples,omitempty"`
	AdditionalProperties interface{} `json:"additional_properties,omitempty"`
	Serialized           []string    `json:"serialized,omitempty"`

	BaseDir  string `json:"-"`
	FilePath string `json:"-"`
}

func DecodeIndexFile

func DecodeIndexFile(file io.Reader) (*Index, error)

func ReadIndexFile

func ReadIndexFile(path string) (*Index, error)

func UnmarshalIndexFile

func UnmarshalIndexFile(v []byte) (*Index, error)

func (*Index) Check

func (idx *Index) Check() error

func (*Index) Clone

func (idx *Index) Clone() *Index

func (*Index) GenerateIndexRaml

func (idx *Index) GenerateIndexRaml(includeExamples bool) string

func (*Index) GetAssets

func (idx *Index) GetAssets() []string

func (*Index) GetDictionaries

func (idx *Index) GetDictionaries() (Dictionaries, error)

func (*Index) GetEntities

func (idx *Index) GetEntities() ([]Entity, error)

func (*Index) PutSerialized

func (idx *Index) PutSerialized(file string)

func (*Index) Save

func (idx *Index) Save() error

func (*Index) ToBytes

func (idx *Index) ToBytes() []byte

type IndexLock

type IndexLock struct {
	Version string `json:"version"`
	// Reverse map: key - application code, value - SourceInfo
	Sources map[string]SourceInfo `json:"sources"`
	// Direct map: key - source, value - PackageInfo
	Packages map[string]PackageInfo `json:"packages"`

	BaseDir  string `json:"-"`
	FilePath string `json:"-"`
}

func MakeIndexLock

func MakeIndexLock(pkgDir string) (*IndexLock, error)

func (*IndexLock) Save

func (idx *IndexLock) Save() error

type LangCode

type LangCode string

type Package

type Package struct {
	Index     *Index
	IndexLock *IndexLock

	BaseDir string
}

func New

func New(path string) (*Package, error)

func (*Package) SaveIndex

func (pkg *Package) SaveIndex() error

func (*Package) SaveIndexLock

func (pkg *Package) SaveIndexLock() error

type PackageInfo

type PackageInfo struct {
	Name      string   `json:"name"`
	AppCode   string   `json:"app_code"`
	Version   string   `json:"version"`
	Integrity string   `json:"integrity"`
	Source    string   `json:"source"`
	Depends   []string `json:"depends"`
}

type SourceInfo

type SourceInfo struct {
	Source string `json:"source"`
}

Jump to

Keyboard shortcuts

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