fspath

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2019 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Generator

type Generator interface {
	Generate(string) string
}

Generator generates a relative, solidus delimited file path from a given identifier. The resulting paths may be used for mapping OCFL object identifiers to ocfl object root directories (possibly with intervening directories, e.g. pairtrees), as well as mapping file logical paths to physical paths.

type GeneratorFunc

type GeneratorFunc func(string) string

GeneratorFunc is a function that can be used to satisfy the Generator interface

Example

Creates an fspath.Generator instance from the builtin uri.QueryEscape function

package main

import (
	"fmt"
	"net/url"

	"github.com/birkland/ocfl/fspath"
)

func main() {
	var pathgen fspath.Generator = fspath.GeneratorFunc(url.QueryEscape)
	fmt.Println(pathgen.Generate("foo:bar"))
}
Output:

foo%3Abar

func (GeneratorFunc) Generate

func (g GeneratorFunc) Generate(id string) string

Generate a path from a given id string

Jump to

Keyboard shortcuts

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