Die API-Referenz stammt aus den Go-Doc-Kommentaren im Quellcode und ist auf Englisch verfasst.
package mergegame
import "github.com/nsgo-dev/game/pkg/mergegame"Übersicht
Package mergegame is experimental: its API and documented formats may change in a minor release. See the API stability policy. defines the small, deterministic data contract used by merge-game templates. A chain lists ordered tiers and their sell values.
Index
Konstanten
Funktionen
func Encode(d Document) ([]byte, error)Encode validates d and writes its deterministic YAML representation.
Typen
type Chain struct {
// ID is the chain's non-empty identifier without surrounding spaces, unique within the document.
ID string `yaml:"id"`
// Tiers lists at least two tiers from lowest to highest, each with an ID unique within the chain.
Tiers []Tier `yaml:"tiers"`
}Chain describes the ordered tiers in one progression path.
type Document struct {
// Version is the format version and must be FormatVersion.
Version int `yaml:"version"`
// Chains lists at least one chain, each with a unique ID.
Chains []Chain `yaml:"chains"`
}Document is a versioned collection of merge chains.
func Parse(data []byte) (Document, error)Parse decodes and validates one canonical merge-chain YAML document.
func (d Document) ChainIDs() []stringChainIDs returns chain IDs in document order.
func (d Document) Next(chainID, tierID string) (Tier, bool)Next returns the tier immediately after tierID in chainID. It reports false when the tier is the chain's final tier or either ID is unknown.
func (d Document) SortedChainIDs() []stringSortedChainIDs returns a stable alphabetical copy of chain IDs.
func (d Document) Validate() errorValidate reports whether d has a supported version and unique valid chains and tiers.