annote

package
v0.0.0-...-d4d6539 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2021 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HNow = iota
	HExit

	StatusWaiting = iota
	StatusHarvesting
)

Variables

View Source
var (
	FileCacheRoot string
	TimeoutClient *http.Client
	ErrDownload   = errors.New("Error copying data from Curate")
)
View Source
var (
	ErrNotFound      = errors.New("Item Not Found in Fedora")
	ErrNotAuthorized = errors.New("Access Denied")
	ErrNeedPID       = errors.New("PID missing")
)

Exported errors

View Source
var (
	Templates      *template.Template
	Datasource     *MysqlDB
	TargetFedora   *RemoteFedora
	StaticFilePath string
	CurateURL      string
)
View Source
var (
	AnnoChan chan struct{}
)
View Source
var (
	ErrNoContent = errors.New("No content")
)
View Source
var (
	ErrPasswordMismatch = errors.New("Password does not match")
)
View Source
var Prefixes = map[string]string{
	"info:fedora/und:":                                       "und:",
	"info:fedora/afmodel:":                                   "",
	"http://purl.org/dc/terms/":                              "dc:",
	"https://library.nd.edu/ns/terms/":                       "nd:",
	"http://purl.org/ontology/bibo/":                         "bibo:",
	"http://www.ndltd.org/standards/metadata/etdms/1.1/":     "ms:",
	"http://purl.org/vra/":                                   "vracore:",
	"http://id.loc.gov/vocabulary/relators/":                 "mrel:",
	"http://www.ebu.ch/metadata/ontologies/ebucore/ebucore#": "ebucore:",
	"http://xmlns.com/foaf/0.1/":                             "foaf:",
	"http://projecthydra.org/ns/relations#":                  "hydra:",
	"http://www.w3.org/2000/01/rdf-schema#":                  "rdfs:",
	"http://purl.org/pav/":                                   "pav:",
}

Functions

func AboutShow

func AboutShow(w http.ResponseWriter, r *http.Request, ps httprouter.Params)

func AddRoutes

func AddRoutes() http.Handler

func AnnotationCounts

func AnnotationCounts(uuid string) int

AnnotationCounts will return the number of annotations on item uuid.

func AnnototCreate

func AnnototCreate(w http.ResponseWriter, r *http.Request, ps httprouter.Params)

AnnototCreate creates a new annotation.

POST /annotot body of request is the annotation in JSON

func AnnototListAll

func AnnototListAll(w http.ResponseWriter, r *http.Request, ps httprouter.Params)

AnnototList displays all the tots in the database

GET /annotot This returns HTML

func AnnototPages

func AnnototPages(w http.ResponseWriter, r *http.Request, ps httprouter.Params)

AnnototPages returns a list of annotations for a given object.

GET /annotot/pages

The object is passed in with the `uri=` parameter. The result list contains the contents for all the annotations on that object.

func AnnototUpdate

func AnnototUpdate(w http.ResponseWriter, r *http.Request, ps httprouter.Params)

AnnototUpdate updates a given annotation

PATCH /annotot/:uuid the body is an annotation as JSON, just as with AnnototCreate

func ApplyPrefixes

func ApplyPrefixes(s string) string

func BackgroundHarvester

func BackgroundHarvester()

func CheckPassword

func CheckPassword(username, pass string) error

CheckPassword takes the given user name and password, compares it against what is in the database and returns either nil, for a match, the error ErrPasswordMismatch if the username/password don't match.

func ClearUserFromCache

func ClearUserFromCache(username string)

func ConfigPage

func ConfigPage(w http.ResponseWriter, r *http.Request, ps httprouter.Params)

func CreateResetToken

func CreateResetToken(username string) (string, error)

func DoTemplate

func DoTemplate(w io.Writer, name string, data interface{})

func DownloadFileToCache

func DownloadFileToCache(base string, url string) error

func FindFileInCache

func FindFileInCache(base string) string

FindFileInCache will see if the given base name is in the cache. It it is, an absolute path to the file is returned. Otherwise an empty string is returned.

func GetObject

func GetObject(w http.ResponseWriter, r *http.Request, ps httprouter.Params)

func HarvestCurateObjects

func HarvestCurateObjects(remote *RemoteFedora, since time.Time, f func(CurateItem) error) error

func IndexEverything

func IndexEverything(w http.ResponseWriter, r *http.Request, ps httprouter.Params)

func IndexHandler

func IndexHandler(w http.ResponseWriter, r *http.Request, ps httprouter.Params)

IndexHandler responds to the root route.

func LoadTemplates

func LoadTemplates(path string) error

LoadTemplates will load and compile our templates into memory

func NewIdentifier

func NewIdentifier() string

NewIdentifier returns a unique string suitable for use in URLs and filenames. This implementation uses randomness, so there is a small possibility of duplicate identifiers being generated.

func NotImplemented

func NotImplemented(w http.ResponseWriter, r *http.Request, ps httprouter.Params)

func ObjectAnnotate

func ObjectAnnotate(w http.ResponseWriter, r *http.Request, ps httprouter.Params)

func ObjectDownload

func ObjectDownload(w http.ResponseWriter, r *http.Request, ps httprouter.Params)

func ObjectDownloadThumbnail

func ObjectDownloadThumbnail(w http.ResponseWriter, r *http.Request, ps httprouter.Params)

func ObjectEdit

func ObjectEdit(w http.ResponseWriter, r *http.Request, ps httprouter.Params)

func ObjectIndex

func ObjectIndex(w http.ResponseWriter, r *http.Request, ps httprouter.Params)

func ObjectNew

func ObjectNew(w http.ResponseWriter, r *http.Request, ps httprouter.Params)

func ObjectNewPost

func ObjectNewPost(w http.ResponseWriter, r *http.Request, ps httprouter.Params)

func ObjectShow

func ObjectShow(w http.ResponseWriter, r *http.Request, ps httprouter.Params)

func ParseNotWellformedTime

func ParseNotWellformedTime(input string) time.Time

func PrintItem

func PrintItem(item CurateItem) error

func ProfileEditShow

func ProfileEditShow(w http.ResponseWriter, r *http.Request, ps httprouter.Params)

func ProfileEditUpdate

func ProfileEditUpdate(w http.ResponseWriter, r *http.Request, ps httprouter.Params)

func ProfileNewPost

func ProfileNewPost(w http.ResponseWriter, r *http.Request, ps httprouter.Params)

func ProfileNewShow

func ProfileNewShow(w http.ResponseWriter, r *http.Request, ps httprouter.Params)

func ProfileShow

func ProfileShow(w http.ResponseWriter, r *http.Request, ps httprouter.Params)

func ProfileUpdate

func ProfileUpdate(w http.ResponseWriter, r *http.Request, ps httprouter.Params)

func ReadBendoItem

func ReadBendoItem(remote *RemoteFedora, id string, result *CurateItem) error

func ReadCharacterization

func ReadCharacterization(remote *RemoteFedora, id string, result *CurateItem) error

func ReadContent

func ReadContent(remote *RemoteFedora, id string, result *CurateItem) error

func ReadDescMetadata

func ReadDescMetadata(remote *RemoteFedora, id string, result *CurateItem) error

func ReadProperties

func ReadProperties(remote *RemoteFedora, id string, result *CurateItem) error

func ReadRelsExt

func ReadRelsExt(remote *RemoteFedora, id string, result *CurateItem) error

func ReadRightsMetadata

func ReadRightsMetadata(remote *RemoteFedora, id string, result *CurateItem) error

func ReadThumbnail

func ReadThumbnail(remote *RemoteFedora, id string, result *CurateItem) error

func ResetPassword

func ResetPassword(username string, newpass string) error

func ResetShow

func ResetShow(w http.ResponseWriter, r *http.Request, ps httprouter.Params)

func ResetUpdate

func ResetUpdate(w http.ResponseWriter, r *http.Request, ps httprouter.Params)

func SaveUser

func SaveUser(user *User) error

SaveUser saves the given user record to the database, possibly updating an existing record. User records are identified by their ID number.

func SearchPage

func SearchPage(w http.ResponseWriter, r *http.Request, ps httprouter.Params)

func ShowAnnotateStatus

func ShowAnnotateStatus(w http.ResponseWriter, r *http.Request, ps httprouter.Params)

func ShowForbidden

func ShowForbidden(w http.ResponseWriter)

func StartBackgroundProcess

func StartBackgroundProcess()

func UpdateConfig

func UpdateConfig(w http.ResponseWriter, r *http.Request, ps httprouter.Params)

func VerifyAuth

func VerifyAuth(w http.ResponseWriter, r *http.Request, ps httprouter.Params) bool

VerifyAuth looks at the basic auth username and password. If it is not valid, it returns a response asking for better ones and returns false. If it is valid, it returns true.

Types

type Access

type Access struct {
	Type    string   `xml:"type,attr"`
	Persons []string `xml:"machine>person"`
	Groups  []string `xml:"machine>group"`
}

type AllItems

type AllItems struct {
	Offset int
	Count  int
}

AllItems is a Batcher that will return everything in the database. It returns Count items at a time, which if equalt to 0 defaults to 500 items.

func (*AllItems) Batch

func (a *AllItems) Batch() []CurateItem

type AnnoStore

type AnnoStore struct {
	Host             string
	UsernamePassword string
	ImageViewerHost  string
	OurURL           string
}
var (
	AnnotationStore *AnnoStore
	ErrNoFiles      = errors.New("Item has no attached files")
)

func (*AnnoStore) AnnotationListByUUID

func (as *AnnoStore) AnnotationListByUUID(uuid string) (QueryAnnotationList, error)

func (*AnnoStore) BackgroundRAPchecker

func (as *AnnoStore) BackgroundRAPchecker(c <-chan struct{})

backgroundRAPchecker will poll the annotation server to track the statuses of RAP ingests. It adjusts its polling interval depending on whether there are any pending jobs. Send something on the channel c to notify the poller that there is a new pending job to monitor.

func (*AnnoStore) RAPStatus

func (as *AnnoStore) RAPStatus() ([]RAPs, error)

func (*AnnoStore) UploadItem

func (as *AnnoStore) UploadItem(item CurateItem, uploader *User) (string, error)

func (*AnnoStore) ViewerURL

func (as *AnnoStore) ViewerURL(uuid string) string

type Batcher

type Batcher interface {
	Batch() []CurateItem
}

A Batcher provides a way to iterate through a (potentially very large) set of CurateItems. Each time Batch() is called another subset of the set should be returned. The empty list is returned when there is nothing left and signals that the iteration is finished.

type CurateItem

type CurateItem struct {
	PID        string
	Properties []Pair
}

A CurateItem holds the metadata record for a single collection, item, or file. It consists of our local identifier for the item (with the namespace prefix, if any), and then a sequence of field-value pairs. The field names can repeat. The ordering of the pairs is only important among those having the same field name.

func AttachedFiles

func AttachedFiles(pid string) []CurateItem

func CollectionMembers

func CollectionMembers(pid string) []CurateItem

func FetchOneCurateObject

func FetchOneCurateObject(remote *RemoteFedora, id string) (CurateItem, error)

FetchOneCurateObject loads the given fedora object and interpretes it as if it were a curate object. This means only certain datastreams are downloaded.

func (*CurateItem) Add

func (c *CurateItem) Add(predicate string, value string)

func (*CurateItem) AsAlternate

func (c *CurateItem) AsAlternate() CurateItemAlt

func (*CurateItem) FirstField

func (c *CurateItem) FirstField(targets ...string) string

func (*CurateItem) RemoveAll

func (c *CurateItem) RemoveAll(target string)

type CurateItemAlt

type CurateItemAlt map[string][]string

A CurateItemAlt is an alternative representation of a CurateItem. It consolidates each property field name into a map entry, and arranges the (possibly multiple) values as a list. The PID is stored under the map entry "PID".

type DSList

type DSList struct {
	DS []struct {
		Name string `xml:"dsid,attr"`
	} `xml:"datastream"`
}

type DsInfo

type DsInfo struct {
	Name         string `xml:"dsID,attr"`
	Label        string `xml:"dsLabel"`
	VersionID    string `xml:"dsVersionID"`
	State        string `xml:"dsState"`
	Checksum     string `xml:"dsChecksum"`
	ChecksumType string `xml:"dsChecksumType"`
	MIMEType     string `xml:"dsMIME"`
	Location     string `xml:"dsLocation"`
	LocationType string `xml:"dsLocationType"`
	ControlGroup string `xml:"dsControlGroup"`
	Versionable  bool   `xml:"dsVersionable"`
	Size         int    `xml:"dsSize"`
}

DsInfo holds more complete metadata on a datastream (as opposed to the ContentInfo structure)

type ElasticSearcher

type ElasticSearcher struct {
	Client *elasticsearch.Client
}

func (*ElasticSearcher) IndexBatch

func (e *ElasticSearcher) IndexBatch(source Batcher)

IndexBatch will index a lot of records. It is expected to be more effecient than calling IndexRecord on each record.

func (*ElasticSearcher) IndexRecord

func (e *ElasticSearcher) IndexRecord(item CurateItem)

func (*ElasticSearcher) Search

type Fedora

type Fedora interface {
	// Return the contents of the dsname datastream of object id.
	// You are expected to close it when you are finished.
	//GetDatastream(id, dsname string) (io.ReadCloser, ContentInfo, error)
	// GetDatastreamInfo returns the metadata Fedora stores about the named
	// datastream.
	GetDatastreamInfo(id, dsname string) (DsInfo, error)

	SearchObjects(query string, token string) ([]string, string, error)
}

Fedora represents a Fedora Commons server. The exact nature of the server is unspecified.

type Grouper

type Grouper struct {
	Goal   int
	Source Batcher
	// contains filtered or unexported fields
}

A Grouper wraps a source Batcher and always returns lists containing Goal number of items, except for the last one which may have less.

func (*Grouper) Batch

func (g *Grouper) Batch() []CurateItem

type Hit

type Hit struct {
	PID    string                 `json:"_id"`
	Fields map[string]interface{} `json:"_source"`
}

type ItemAnnotationInfo

type ItemAnnotationInfo struct {
	// the item these annotations are for
	PID string

	// The Primary RAP is the one this user has uploaded. It's UUID is "" if
	// this user has not copied the item to the annotation service.
	Primary RAPInfo

	// the other RAPs are ones other users have uploaded
	Others []RAPInfo
}

func GetAnnotationInfoForItem

func GetAnnotationInfoForItem(pid string, username string) ItemAnnotationInfo

type ItemUUID

type ItemUUID struct {
	Item     string
	Username string
	UUID     string
	Status   string
}

type LimitedToken

type LimitedToken struct {
	Token   string
	Creator string
	Created time.Time
	Item    string
	Expire  time.Time
	Used    bool
}

func CreateLimitedToken

func CreateLimitedToken(item string, user string) *LimitedToken

type MysqlDB

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

store pointer to sql database

func NewMySQL

func NewMySQL(conn string) (*MysqlDB, error)

NewMySQL returns a Repository backed by a MySQL database, as determined by the connection string. An error is returned if any problems are run into.

func (*MysqlDB) FindAllRange

func (sq *MysqlDB) FindAllRange(offset, count int) ([]CurateItem, error)

FindAllRange returns a list of every purl in the database.

func (*MysqlDB) FindCollectionMembers

func (sq *MysqlDB) FindCollectionMembers(pid string) ([]CurateItem, error)

func (*MysqlDB) FindItem

func (sq *MysqlDB) FindItem(pid string) (CurateItem, error)

FindItem returns a single CurateItem record identified by PID.

func (*MysqlDB) FindItemFiles

func (sq *MysqlDB) FindItemFiles(pid string) ([]CurateItem, error)

func (*MysqlDB) FindUser

func (sq *MysqlDB) FindUser(username string) (*User, error)

func (*MysqlDB) FindUserByToken

func (sq *MysqlDB) FindUserByToken(token string) (*User, error)

func (*MysqlDB) IndexBatch

func (sq *MysqlDB) IndexBatch(source Batcher)

func (*MysqlDB) IndexItem

func (sq *MysqlDB) IndexItem(item CurateItem) error

func (*MysqlDB) IndexRecord

func (sq *MysqlDB) IndexRecord(item CurateItem)

func (*MysqlDB) ReadConfig

func (sq *MysqlDB) ReadConfig(key string) (string, error)

func (*MysqlDB) RecordEvent

func (sq *MysqlDB) RecordEvent(event string, user *User, other string)

func (*MysqlDB) SaveUser

func (sq *MysqlDB) SaveUser(user *User) error

func (*MysqlDB) Search

func (sq *MysqlDB) Search(q SearchQuery) (SearchResults, error)

func (*MysqlDB) SearchItemUUID

func (sq *MysqlDB) SearchItemUUID(item string, username string, status string) ([]ItemUUID, error)

func (*MysqlDB) SetConfig

func (sq *MysqlDB) SetConfig(key string, value string) error

func (*MysqlDB) TotCreate

func (sq *MysqlDB) TotCreate(tot tots) error

func (*MysqlDB) TotUpdateData

func (sq *MysqlDB) TotUpdateData(tot tots) error

update the annotation given by tot.UUID to have tot.Data

func (*MysqlDB) TotsByCanvas

func (sq *MysqlDB) TotsByCanvas(canvas string) ([]tots, error)

func (*MysqlDB) UpdateUUID

func (sq *MysqlDB) UpdateUUID(record ItemUUID) error

type NewUserData

type NewUserData struct {
	Message  string
	Username string
	ORCID    string
}

type ObjectInfo

type ObjectInfo struct {
	PID         string    `xml:"pid,attr"`
	Label       string    `xml:"objLabel"`
	CreateDate  time.Time `xml:"objCreateDate"`
	LastModDate time.Time `xml:"objLastModDate"`
	State       string    `xml:"objState"`
}

type Pair

type Pair struct {
	Predicate string
	Object    string
}

type PredicatePair

type PredicatePair struct {
	XMLName xml.Name
	V       string `xml:",any,attr"`
}

type QueryAnnotationList

type QueryAnnotationList struct {
	Error       string `json:"error"`
	ID          string `json:"@id"`
	Annotations []struct {
		Type      string `json:"@type"`
		ID        string `json:"@id"`
		AnnoStore struct {
			RA string `json:"researchActivity"`
		} `json:"__annostore"`
		Author struct {
			ID   string `json:"@id"`
			Name string `json:"name"`
		} `json:"annotatedBy"`
		Created    time.Time `json:"annotatedAt"`
		Motivation []string  `json:"motivation"`
	} `json:"resources"`
}

type RAPInfo

type RAPInfo struct {
	UUID      string
	Count     int    // number of annotations on it
	Depositor string // username of who uploaded it
}

type RAPs

type RAPs struct {
	ID     string
	UUID   string `json:"uuid"`
	PID    string `json:"pid"`
	Status struct {
		Code        string `json:"code"`
		Description string `json:"desc"`
	} `json:"status"`
}

type RelsExtDS

type RelsExtDS struct {
	Description struct {
		P []PredicatePair `xml:",any"`
	} `xml:"Description"`
}

type RemoteFedora

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

func NewRemote

func NewRemote(fedoraPath string) *RemoteFedora

NewRemote creates a reference to a remote Fedora repository. fedoraPath is a complete URL including username and password, if necessary. For example

http://fedoraAdmin:password@localhost:8983/fedora/

The returned structure does not buffer or cache Fedora responses.

func (*RemoteFedora) GetDatastream

func (rf *RemoteFedora) GetDatastream(id, dsname string) (io.ReadCloser, error)

returns the contents of the datastream `dsname`. The returned stream needs to be closed when finished.

func (*RemoteFedora) GetDatastreamInfo

func (rf *RemoteFedora) GetDatastreamInfo(id, dsname string) (DsInfo, error)

func (*RemoteFedora) GetDatastreamList

func (rf *RemoteFedora) GetDatastreamList(id string) ([]string, error)

func (*RemoteFedora) GetObjectInfo

func (rf *RemoteFedora) GetObjectInfo(id string) (ObjectInfo, error)

func (*RemoteFedora) MakeDatastream

func (rf *RemoteFedora) MakeDatastream(id string, info DsInfo, content io.Reader) error

func (*RemoteFedora) MakeObject

func (rf *RemoteFedora) MakeObject(info ObjectInfo) error

func (*RemoteFedora) SearchObjects

func (rf *RemoteFedora) SearchObjects(query string, token string) ([]string, string, error)

func (*RemoteFedora) UpdateDatastream

func (rf *RemoteFedora) UpdateDatastream(id string, info DsInfo, content io.Reader) error

type SearchQuery

type SearchQuery struct {
	Query   string
	Start   int
	NumRows int
}

type SearchResults

type SearchResults struct {
	Total int
	Items []CurateItem
}

type Searcher

type Searcher interface {
	Search(q SearchQuery) (SearchResults, error)

	IndexRecord(item CurateItem)

	IndexBatch(source Batcher)
}

A Searcher represents our interface to an external index service.

var (
	SearchEngine Searcher
)

func NewElasticSearch

func NewElasticSearch(address string) Searcher

type SolrInfo

type SolrInfo struct {
	Host string
}
var (
	Solr *SolrInfo
)

func (*SolrInfo) IndexBatch

func (si *SolrInfo) IndexBatch(source Batcher)

func (*SolrInfo) IndexRecord

func (si *SolrInfo) IndexRecord(item CurateItem)

IndexRecord and IndexBatch for Solr is not supported.

func (*SolrInfo) Search

func (si *SolrInfo) Search(q SearchQuery) (SearchResults, error)

func (*SolrInfo) SendQuery

func (si *SolrInfo) SendQuery(q SolrQuery) (SolrResponse, error)

type SolrQuery

type SolrQuery struct {
	Query       string
	QueryFields []string
	FieldList   []string
	Start       int
	Rows        int
	Sort        []string
	FilterQuery []string
	Facets      []string
}

type SolrResponse

type SolrResponse struct {
	Response struct {
		NumFound int                       `json:"numFound"`
		Start    int                       `json:"start"`
		MaxScore float32                   `json:"maxScore"`
		Docs     []map[string]StringOrList `json:"docs"`
	} `json:"response"`
}

type Store

type Store struct {
	Root string
}

Store provides a place to save file content. At some point it would be nice for it to provide versioning.

var (
	FileStore Store
)

func (*Store) Create

func (s *Store) Create(key string) (io.WriteCloser, error)

func (*Store) Find

func (s *Store) Find(key string) string

Find returns an absolute file path to the given item.

func (*Store) MakeThumbnailImage

func (s *Store) MakeThumbnailImage(key string) error

func (*Store) MakeThumbnailPDF

func (s *Store) MakeThumbnailPDF(key string) error

func (*Store) Open

func (s *Store) Open(key string) (io.ReadCloser, error)

type StringOrList

type StringOrList []string

StringOrList is used to decode json documents having values that may either be a string or a list of strings. It makes everything a list of strings, so that we have a consistent data type.

func (*StringOrList) UnmarshalJSON

func (x *StringOrList) UnmarshalJSON(b []byte) error

type SubmitRA

type SubmitRA struct {
	ID            string
	PID           string            `json:"pid"`
	Action        string            `json:"action"`
	RepositoryURL string            `json:"repository-url"`
	Title         string            `json:"title"`
	Description   string            `json:"description"`
	Owners        []string          `json:"owners"`
	DateCreated   time.Time         `json:"date-created"`
	Creators      []string          `json:"creators"`
	AccessView    []string          `json:"access-view"`
	AccessEdit    []string          `json:"access-edit"`
	Metadata      map[string]string `json:"metadata"`
}

type SubmitRAP

type SubmitRAP struct {
	ID            string
	PID           string            `json:"pid"`
	Action        string            `json:"action"`
	RepositoryURL string            `json:"repository-url"`
	Title         string            `json:"title"`
	Description   string            `json:"description"`
	Owners        []string          `json:"owners"`
	DateCreated   time.Time         `json:"date-created"`
	Creators      []string          `json:"creators"`
	AccessView    []string          `json:"access-view"`
	AccessEdit    []string          `json:"access-edit"`
	Metadata      map[string]string `json:"metadata"`

	RA               string   `json:"ra"`
	Content          []string `json:"content"`
	ContentChecksums []string `json:"content-checksums"`
	ContentAccess    string   `json:"content-access"`
	Copyright        string   `json:"copyright"`
	License          string   `json:"license"`
}

type TestFedora

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

TestFedora implements a simple in-memory Fedora stub which will return bytes which have already been specified by Set(). Intended for testing. (Maybe move to a testing file?)

func NewTestFedora

func NewTestFedora() *TestFedora

NewTestFedora creates an empty TestFedora object.

func (*TestFedora) GetDatastreamInfo

func (tf *TestFedora) GetDatastreamInfo(id, dsname string) (DsInfo, error)

GetDatastreamInfo returns Fedora's metadata for the given datastream.

func (*TestFedora) Set

func (tf *TestFedora) Set(id, dsname string, info DsInfo, value []byte)

Set the given datastream to have the given content.

type Thumbnail

type Thumbnail struct {
	Source *Store
	// contains filtered or unexported fields
}

func (*Thumbnail) DoImage

func (t *Thumbnail) DoImage(item string) error

func (*Thumbnail) DoPDF

func (t *Thumbnail) DoPDF(item string) error

DoPDF will read the given content file from the store, create a thumbnail, and then copy it back into the store under the key "$item-thumbnail"

type User

type User struct {
	ID             int
	Username       string
	HashedPassword string
	Created        time.Time
	ORCID          string
}

func CreateNewUser

func CreateNewUser(username string) (*User, error)

func FindUser

func FindUser(username string) *User

FindUser returns a user record for the given user name. If there is no such user record in the database, nil is returned.

func FindUserByToken

func FindUserByToken(token string) *User

FindUserByToken returns a user record given a password reset token. If there is no such token, nil is returned.

Jump to

Keyboard shortcuts

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