dvargen

package module
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2023 License: MIT Imports: 7 Imported by: 2

README

DVarGen

Generates a map variable initialized with the contents of the directory.

Documentation

Index

Constants

View Source
const FilenameExtension = ".dvar.go"

FilenameExtension is an extension of the generated files.

Variables

View Source
var DefConf = Conf{
	Path: "./",
	Perm: 0755,
}

DefConf is the default configuration for DVarGen.

View Source
var ErrSubdir = errors.New("directory should not contain sub directories")

ErrSubdir happens when directory contains sub directories.

Functions

This section is empty.

Types

type Conf

type Conf struct {
	Path string      // Path of the generated file.
	Perm fs.FileMode // Perm of the generated file.
}

Conf configures the generation process.

type DVarDesc

type DVarDesc struct {
	Dir     string // Generates var from content of this directory.
	Varname string // Name of the generated var, also name of the generated
	// file.
	Package string // Package of the generated file.
}

DVarDesc is te description of the generated var.

type DVarGen added in v0.1.1

type DVarGen struct {
	// contains filtered or unexported fields
}

DVarGen generates a map variable initialized with the contents of the directory.

func New added in v0.1.1

func New() DVarGen

New creates a new DVarGen.

func NewWith added in v0.1.1

func NewWith(persistor persistor_mod.Persistor) DVarGen

New creates a new configurable DVarGen.

func (DVarGen) Generate added in v0.1.1

func (dVarGen DVarGen) Generate(vDesc DVarDesc) error

Generate generates a file with Golang source code, which initializes a map variable with directory content. Each key of this map is a file name, and value - file data. Uses DefConf.

func (DVarGen) GenerateAs added in v0.1.1

func (dVarGen DVarGen) GenerateAs(vDesc DVarDesc, conf Conf) error

GenerateAs performs like generate. With help of this method you can configure the generation process.

Jump to

Keyboard shortcuts

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