dbd

package
v0.0.288 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package dbd parses WoWDBDefs .dbd definition files and selects the version block matching an exact build number.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FetchCached

func FetchCached(cacheDir, tableName string) (string, error)

FetchCached returns the path to a cached .dbd for tableName under cacheDir, fetching from WoWDBDefs when the cached copy is absent or older than 24h. On a failed refresh of an existing copy, the stale copy is used; a missing copy that cannot be fetched is fatal.

Types

type Build

type Build struct {
	Expansion int16
	Major     int16
	Minor     int16
	Build     uint32
}

func ParseBuild

func ParseBuild(s string) (Build, error)

func (Build) Compare

func (b Build) Compare(o Build) int

func (Build) String

func (b Build) String() string

type BuildRange

type BuildRange struct {
	MinBuild Build
	MaxBuild Build
}

func (BuildRange) Contains

func (r BuildRange) Contains(b Build) bool

func (BuildRange) String

func (r BuildRange) String() string

type ColumnDefinition

type ColumnDefinition struct {
	Type          string
	ForeignTable  string
	ForeignColumn string
	Verified      bool
	Comment       string
}

type DBDefinition

type DBDefinition struct {
	ColumnDefinitions  map[string]ColumnDefinition
	VersionDefinitions []VersionDefinitions
}

func Read

func Read(r io.Reader, validate bool) (DBDefinition, error)

Read parses a .dbd definition stream. It is a line-for-line transcription of the upstream reader (deliberately faithful even where behavior is quirky).

func ReadFile

func ReadFile(path string, validate bool) (DBDefinition, error)

ReadFile parses a .dbd definition file from disk.

type Definition

type Definition struct {
	Size        int
	ArrLength   int
	Name        string
	IsID        bool
	IsRelation  bool
	IsNonInline bool
	IsSigned    bool
	Comment     string
}

type VersionDefinitions

type VersionDefinitions struct {
	Builds       []Build
	BuildRanges  []BuildRange
	LayoutHashes []string
	Comment      string
	Definitions  []Definition
}

func SelectVersion

func SelectVersion(def DBDefinition, buildNumber uint32) (VersionDefinitions, error)

SelectVersion returns the LAST versionDefinition (in file order) whose Builds list contains an entry with trailing build number == buildNumber.

Exact equality on the trailing build number only — buildRanges and layoutHashes are deliberately NOT consulted: WoWDBDefs lists the live builds explicitly for every configured table, and failing loud here beats silently decoding with a near-miss layout.

Jump to

Keyboard shortcuts

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