parser

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewRandomID

func NewRandomID() string

NewRandomID generates a new random ID.

  • 16 characters

func Run

func Run(cmd *cobra.Command, args []string) error

Run parses the database files and converts the IDs

Types

type Document

type Document struct {
	// OldID of the document
	OldID string `json:"_id"`
	// Name of the document
	Name string `json:"name"`
	// NewID of the document
	NewID string
}

Document within the database

func ParseDocument

func ParseDocument(in []byte) (Document, error)

ParseDocument from JSON bytes

type Option

type Option func(*Options)

Option applies an option to the Options

func Path

func Path(a string) Option

Path sets the path to the FoundryVTT world data directory

func Verbose

func Verbose(a bool) Option

Verbose sets the verbose option

type Options

type Options struct {
	// Path to the FoundryVTT world data directory
	Path string
	// Verbose logging
	Verbose bool
}

Options for the parser

func NewOptions

func NewOptions(opt ...Option) Options

NewOptions returns the initialised Options

type Service

type Service struct {
	// Options for the parser
	Options Options
	// contains filtered or unexported fields
}

Service for parsing the database files

func (*Service) ParseFile

func (s *Service) ParseFile(file string) ([]Document, error)

ParseFile parses a database file

func (*Service) UpdateFile

func (s *Service) UpdateFile(file string, idMap map[string]string) error

UpdateFile updates a database file with the new IDs

func (*Service) Validate

func (s *Service) Validate() error

Validate the options

Jump to

Keyboard shortcuts

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