assetutil

package
v0.1.367 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2024 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Overview

Copyright 2015 by Leipzig University Library, http://ub.uni-leipzig.de
                  The Finc Authors, http://finc.info
                  Martin Czygan, <martin.czygan@uni-leipzig.de>

This file is part of some open source application.

Some open source application is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

Some open source application is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with Foobar. If not, see <http://www.gnu.org/licenses/>.

@license GPL-3.0+ <http://spdx.org/licenses/GPL-3.0+>

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MustLoadStringMap

func MustLoadStringMap(path string) container.MapDefault

MustLoadStringMap loads a JSON file from an asset path and parses it into a container.StringMap. This function will panic, if the asset cannot be found or the JSON is erroneous.

func MustLoadStringSet added in v0.1.56

func MustLoadStringSet(paths ...string) *container.StringSet

MustLoadStringSet load one or more paths containing lines into a string set.

func MustLoadStringSliceMap

func MustLoadStringSliceMap(path string) container.MapSliceDefault

MustLoadStringSliceMap loads a JSON file from an asset path and parses it into a container.StringSliceMap. This function will halt the world, if it is called with an invalid argument.

Types

type RegexpMap

type RegexpMap struct {
	Entries []RegexpMapEntry
}

RegexpMap holds a list of entries, which contain pattern string pairs.

func MustLoadRegexpMap

func MustLoadRegexpMap(path string) RegexpMap

MustLoadRegexpMap loads the content of a given asset path into a RegexpMap. It will panic, if the asset path is not found and if the patterns found in the file cannot be compiled.

func (RegexpMap) LookupDefault

func (r RegexpMap) LookupDefault(s, def string) string

LookupDefault tries to match a given string against patterns. If none of the matterns match, return a given default.

type RegexpMapEntry

type RegexpMapEntry struct {
	Pattern *regexp.Regexp
	Value   string
}

RegexpMapEntry maps a regex pattern to a string value.

Jump to

Keyboard shortcuts

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