pokedex

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2025 License: BSD-3-Clause Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	COLOUR_RESET string = fmt.Sprintf("%s[%dm\n", "\x1b", 39)
)

Functions

func CategoryDirpath added in v0.11.3

func CategoryDirpath(subdir string, cat string) string

func CategoryFpath added in v0.11.3

func CategoryFpath(subdir string, category string, fname string) string

func Check added in v0.11.0

func Check(e error)

func Compress

func Compress(data []byte) []byte

func ConvertPngToCow

func ConvertPngToCow(sourceDirpath string, sourceFpath string, destDirpath string, extraPadding int) (string, error)

func CreateCategoryStruct added in v0.10.0

func CreateCategoryStruct(rootDir string, metadata []PokemonMetadata, debug bool) []string

func Decompress

func Decompress(data []byte) []byte

func EntryFpath

func EntryFpath(subdir string, idx int) string

func FindFiles

func FindFiles(dirpath string, ext string, skip []string) []string

func GatherMapKeys added in v0.11.3

func GatherMapKeys[T any](m map[string]T) []string

func MetadataFpath

func MetadataFpath(subdir string, idx int) string

func ReadIntFromBytes added in v0.11.0

func ReadIntFromBytes(bs []byte) int

func ReadNames added in v0.10.0

func ReadNames(fpath string) map[string]PokemonName

func ReadPokemonCow added in v0.11.0

func ReadPokemonCow(embeddedData embed.FS, fpath string) []byte

func ReadStructFromBytes added in v0.11.0

func ReadStructFromBytes[T any](data []byte) T

func StructToJSON added in v0.11.0

func StructToJSON(obj interface{}, indentation ...int) string

func WriteBytesToFile

func WriteBytesToFile(data []byte, fpath string, compress bool)

func WriteIntToFile added in v0.11.0

func WriteIntToFile(n int, fpath string)

func WriteStructToFile

func WriteStructToFile(obj interface{}, fpath string)

func WriteToCowfile added in v0.15.1

func WriteToCowfile(data string, destDirpath string, destFpath string)

Types

type DataEntry added in v0.10.0

type DataEntry struct {
	Name struct {
		Eng    string `json:"eng"`
		Jpn    string `json:"jpn"`
		Jpn_ro string `json:"jpn_ro"`
	} `json:"name"`
	Slug struct {
		Eng    string `json:"eng"`
		Jpn    string `json:"jpn"`
		Jpn_ro string `json:"jpn_ro"`
	} `json:"slug"`
}
{
  "name": { "eng": "Charizard", "chs": "喷火龙", "jpn": "リザードン", "jpn_ro": "Lizardon" }
  "slug": { "eng": "charizard",                  "jpn": "riza-don",   "jpn_ro": "lizardon" }
}

Out of all these names, we want the name.jpn, name.jpn_ro, slug.eng,

type PokemonEntryMapping added in v0.11.2

type PokemonEntryMapping struct {
	EntryIndex int
	Categories []string
}

type PokemonMetadata

type PokemonMetadata struct {
	Name             string
	JapaneseName     string
	JapanesePhonetic string
	Entries          []PokemonEntryMapping
}

func CreateNameMetadata added in v0.11.2

func CreateNameMetadata(idx int, key string, name PokemonName, rootDir string, fpaths []string) *PokemonMetadata

func NewMetadata added in v0.11.0

func NewMetadata(name string, japaneseName string, japanesePhonetic string, entryMap map[int][][]string) *PokemonMetadata

func ReadMetadataFromBytes

func ReadMetadataFromBytes(data []byte) PokemonMetadata

func ReadMetadataFromEmbedded added in v0.11.0

func ReadMetadataFromEmbedded(embeddedData embed.FS, fpath string) PokemonMetadata

func ReadMetadataFromFile added in v0.11.3

func ReadMetadataFromFile(fpath string) PokemonMetadata

type PokemonName added in v0.10.0

type PokemonName struct {
	English          string
	Japanese         string
	JapanesePhonetic string
	Slug             string
}

func NewPokemonName added in v0.10.0

func NewPokemonName(entry DataEntry) *PokemonName

Jump to

Keyboard shortcuts

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