metadata

package
v0.0.0-...-b3f3fbb Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2015 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package metadata provides persistence for any metadata-like data

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InsertMetadataTx

func InsertMetadataTx(db *sql.Tx, m MetadataModeler, primary int64, metadata Metadata) error

Types

type Metadata

type Metadata map[string]MetadataEntry

Metadata is a collection of metadata entries

func MetadataByPrimaryDB

func MetadataByPrimaryDB(db *sql.DB, m MetadataModeler, primary int64) (Metadata, error)

func MetadataByPrimaryTx

func MetadataByPrimaryTx(db *sql.Tx, m MetadataModeler, primary int64) (Metadata, error)

func MetadataFromValues

func MetadataFromValues(values map[string]string, createdBy string) Metadata

MetadataFromValues creates metadata from a key-value map

func (Metadata) Values

func (m Metadata) Values() map[string]string

Values returns a flattened metadata map as key-values

type MetadataEntry

type MetadataEntry struct {
	Name string

	CreatedBy string
	Value     string
	// contains filtered or unexported fields
}

MetadataEntry represents an entry in metadata

func MetadataByPrimaryAndNameDB

func MetadataByPrimaryAndNameDB(db *sql.DB, m MetadataModeler, primary int64, name string) (MetadataEntry, error)

MetadataByPrimaryAndNameDB selects a specific metadata entry

If no such entry with the name exists, it will return an empty entry

func (MetadataEntry) IsEmpty

func (e MetadataEntry) IsEmpty() bool

IsEmpty returns true if this is an empty (non-existent) entry

type MetadataModeler

type MetadataModeler interface {
	Table() string
	PrimaryField() string
}

MetadataModeler describes the construct for a concrete metadata model

Jump to

Keyboard shortcuts

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