archive

package module
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2021 License: MIT Imports: 14 Imported by: 3

README

archive

Documentation

Index

Constants

View Source
const (
	AttributeEncoding     = "Encoding"
	AttributeETag         = "ETag"
	AttributeExpires      = "Expires"
	AttributeLastModified = "Last-Modified"
	AttributeLabel        = "Label"
	AttributeLength       = "Length"
	AttributeType         = "Type"
)
View Source
const (
	TypeApplicationJSON = "application/json"
	TypeApplicationPDF  = "application/pdf"
	TypeApplicationXML  = "application/xml"
	TypeImageJPEG       = "image/jpeg"
	TypeImagePNG        = "image/png"
	TypeImageSVG        = "image/svg+xml"
	TypeTextCSV         = "text/csv"
	TypeTextHTML        = "text/html"
	TypeTextPlain       = "text/plain"
)
View Source
const (
	EncodingIdentity = "identity"
	EncodingGZIP     = "gzip"
)
View Source
const (
	InfoRevision = "Revision"
)

Variables

This section is empty.

Functions

func LoadJSON

func LoadJSON(a *Archive, id string, v interface{}) error

func LoadXML

func LoadXML(a *Archive, id string, v interface{}) error

Types

type Archive

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

func Open

func Open(dsn string) (*Archive, error)

func (*Archive) Attributes

func (a *Archive) Attributes(id string) (Attributes, error)

func (*Archive) Close

func (a *Archive) Close() error

func (*Archive) Delete

func (a *Archive) Delete(id string) error

func (*Archive) ExportFile

func (a *Archive) ExportFile(id string, file string) error

func (*Archive) ImportFile

func (a *Archive) ImportFile(id string, file string) error

func (*Archive) List

func (a *Archive) List() ([]Descriptor, error)

func (*Archive) ListWithPrefix

func (a *Archive) ListWithPrefix(prefix string) ([]Descriptor, error)

func (*Archive) Load

func (a *Archive) Load(id string) (Resource, error)

func (*Archive) Revision

func (a *Archive) Revision() int

func (*Archive) Store

func (a *Archive) Store(r Resource) error

type Attributes

type Attributes map[string]string

func ParseAttributes

func ParseAttributes(data string) (Attributes, error)

func (Attributes) Clone

func (as Attributes) Clone() Attributes

func (Attributes) Entries

func (as Attributes) Entries() Entries

func (Attributes) String

func (as Attributes) String() string

type Descriptor

type Descriptor struct {
	ID         string
	Attributes Attributes
}

type Entries

type Entries []Entry

func (Entries) Len

func (s Entries) Len() int

func (Entries) Less

func (s Entries) Less(i, j int) bool

func (Entries) Swap

func (s Entries) Swap(i, j int)

type Entry

type Entry struct {
	Key   string
	Value string
}

type Resource

type Resource struct {
	ID         string
	Attributes Attributes
	Data       []byte
}

func GenericJSON

func GenericJSON(id string, v interface{}) Resource

func GenericXML

func GenericXML(id string, v interface{}) (Resource, error)

func JPEG

func JPEG(id string, data []byte) Resource

func JSON

func JSON(id string, t string, v interface{}) Resource

func MakeResource

func MakeResource(id string, as Attributes, data []byte) Resource

func TextPlain

func TextPlain(id string, text string) Resource

func XML

func XML(id string, t string, v interface{}) (Resource, error)

func (Resource) String

func (r Resource) String() string

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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