API 레퍼런스는 소스 코드의 Go 문서 주석에서 추출되며 영어로 작성되어 있습니다.
package mergegame
import "github.com/nsgo-dev/game/pkg/mergegame"개요
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.
색인
상수
함수
func Encode(d Document) ([]byte, error)Encode validates d and writes its deterministic YAML representation.
타입
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.