Documentation
¶
Overview ¶
Package repository defines interfaces and error types for annotation data storage.
Index ¶
- func IsAnnoTagNotFound(err error) bool
- func IsAnnotationGroupListNotFound(err error) bool
- func IsAnnotationListNotFound(err error) bool
- func IsAnnotationNotFound(err error) bool
- func IsFeatureNameNotFound(err error) bool
- func IsGroupNotFound(err error) bool
- func IsListNotFound(err error) bool
- func IsOrganismNotFound(err error) bool
- func IsPublicationAnnotationNotFound(err error) bool
- type AnnoGroupListNotFoundError
- type AnnoListNotFoundError
- type AnnoNotFoundError
- type AnnoTagNotFoundError
- type FeatureAnnotationRepository
- type FeatureNameNotFoundError
- type GroupNotFoundError
- type ListAnnotationsParams
- type ListNotFoundError
- type OrganismNotFoundError
- type OrganismRepository
- type PublicationAnnotationNotFoundError
- type TaggedAnnotationRepository
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsAnnoTagNotFound ¶
IsAnnoTagNotFound reports whether err is an AnnoTagNotFoundError.
func IsAnnotationGroupListNotFound ¶
IsAnnotationGroupListNotFound reports whether err is an AnnoGroupListNotFoundError.
func IsAnnotationListNotFound ¶
IsAnnotationListNotFound reports whether err is an AnnoListNotFoundError.
func IsAnnotationNotFound ¶
IsAnnotationNotFound reports whether err is an AnnoNotFoundError.
func IsFeatureNameNotFound ¶
IsFeatureNameNotFound checks if the error is a FeatureNameNotFoundError.
func IsGroupNotFound ¶
IsGroupNotFound reports whether err is a GroupNotFoundError.
func IsListNotFound ¶
IsListNotFound reports whether err is a ListNotFoundError.
func IsOrganismNotFound ¶
IsOrganismNotFound reports whether err is an OrganismNotFoundError.
func IsPublicationAnnotationNotFound ¶
IsPublicationAnnotationNotFound reports whether err is a PublicationAnnotationNotFoundError.
Types ¶
type AnnoGroupListNotFoundError ¶
type AnnoGroupListNotFoundError struct{}
AnnoGroupListNotFoundError is returned when the annotation group list is empty or not found.
func (*AnnoGroupListNotFoundError) Error ¶
func (agl *AnnoGroupListNotFoundError) Error() string
type AnnoListNotFoundError ¶
type AnnoListNotFoundError struct{}
AnnoListNotFoundError is returned when the annotation list is empty or not found.
func (*AnnoListNotFoundError) Error ¶
func (al *AnnoListNotFoundError) Error() string
type AnnoNotFoundError ¶
type AnnoNotFoundError struct {
ID string
}
AnnoNotFoundError is returned when an annotation with the given ID does not exist.
func (*AnnoNotFoundError) Error ¶
func (ae *AnnoNotFoundError) Error() string
type AnnoTagNotFoundError ¶
type AnnoTagNotFoundError struct {
Tag string
}
AnnoTagNotFoundError is returned when an annotation tag is not found.
func (*AnnoTagNotFoundError) Error ¶
func (at *AnnoTagNotFoundError) Error() string
type FeatureAnnotationRepository ¶
type FeatureAnnotationRepository interface {
// GetFeatureAnnotation retrieves a feature annotation by ID
GetFeatureAnnotation(id string) (*model.FeatureAnnotationDoc, error)
// GetFeatureAnnotationByName retrieves a feature annotation by name
GetFeatureAnnotationByName(name string) (*model.FeatureAnnotationDoc, error)
// AddFeatureAnnotation creates a new feature annotation
AddFeatureAnnotation(
doc *feature.NewFeatureAnnotation,
) (*model.FeatureAnnotationDoc, error)
// EditFeatureAnnotation updates an existing feature annotation
EditFeatureAnnotation(
doc *feature.FeatureAnnotationUpdate,
) (*model.FeatureAnnotationDoc, error)
// RemoveFeatureAnnotation deletes a feature annotation
RemoveFeatureAnnotation(id string, purge bool) error
// ClearFeatureAnnotations removes all feature annotations
ClearFeatureAnnotations() error
// Dbh returns the underlying database handler
Dbh() *manager.Database
// Tag management methods
// AddTag adds a single tag to an existing feature annotation
AddTag(req *feature.AddTagRequest) (*model.FeatureAnnotationDoc, error)
// AddTags adds multiple tags to an existing feature annotation
AddTags(req *feature.AddTagsRequest) (*model.FeatureAnnotationDoc, error)
// SetTags replaces all tags for a feature annotation with the provided set
SetTags(req *feature.SetTagsRequest) (*model.FeatureAnnotationDoc, error)
// RemoveTags removes tags from a feature annotation by tag and value
RemoveTags(req *feature.RemoveTagsRequest) (*model.FeatureAnnotationDoc, error)
// Publication-based queries
// ListByPublicationID retrieves all feature annotations associated with the given publication ID and source
ListByPublicationID(id string, source string) ([]*model.FeatureAnnotationDoc, error)
}
FeatureAnnotationRepository is an interface for accessing feature annotation data from its data sources.
type FeatureNameNotFoundError ¶
type FeatureNameNotFoundError struct {
Name string
}
FeatureNameNotFoundError indicates that a feature annotation with the given name was not found.
func (*FeatureNameNotFoundError) Error ¶
func (fnf *FeatureNameNotFoundError) Error() string
Error returns the error message for FeatureNameNotFoundError.
type GroupNotFoundError ¶
type GroupNotFoundError struct {
ID string
}
GroupNotFoundError is returned when an annotation group with the given ID does not exist.
func (*GroupNotFoundError) Error ¶
func (ge *GroupNotFoundError) Error() string
type ListAnnotationsParams ¶
type ListAnnotationsParams struct {
Cursor int64
Limit int64 `validate:"required"`
Filter string `validate:"required"`
}
ListAnnotationsParams defines the parameters for listing annotations.
type ListNotFoundError ¶
type ListNotFoundError struct{}
ListNotFoundError is returned when a generic list is empty or not found.
func (*ListNotFoundError) Error ¶
func (lnf *ListNotFoundError) Error() string
type OrganismNotFoundError ¶
type OrganismNotFoundError struct {
ID string
}
OrganismNotFoundError is returned when an organism with the given ID does not exist.
func (*OrganismNotFoundError) Error ¶
func (onf *OrganismNotFoundError) Error() string
type OrganismRepository ¶
type OrganismRepository interface {
// GetOrganism retrieves an organism by ID
GetOrganism(id string) (*model.OrganismDoc, error)
// GetOrganismByName retrieves an organism by scientific name (genus + species)
GetOrganismByName(genus, species string) (*model.OrganismDoc, error)
// AddOrganism creates a new organism
AddOrganism(doc *organism.NewOrganism) (*model.OrganismDoc, error)
// EditOrganism updates an existing organism
EditOrganism(doc *organism.OrganismUpdate) (*model.OrganismDoc, error)
// RemoveOrganism deletes an organism
RemoveOrganism(id string) error
// ListOrganisms provides a paginated list of organisms along with optional filtering
ListOrganisms() ([]*model.OrganismDoc, error)
// ClearOrganisms removes all organisms
ClearOrganisms() error
// Dbh returns the underlying database handler
Dbh() *manager.Database
}
OrganismRepository is an interface for accessing organism data from its data sources.
type PublicationAnnotationNotFoundError ¶
PublicationAnnotationNotFoundError is returned when no annotations are found for a publication ID.
func (*PublicationAnnotationNotFoundError) Error ¶
func (panf *PublicationAnnotationNotFoundError) Error() string
type TaggedAnnotationRepository ¶
type TaggedAnnotationRepository interface {
// GetAnnotationById retrieves an annotation
GetAnnotationByID(id string) (*model.AnnoDoc, error)
GetAnnotationByEntry(
req *annotation.EntryAnnotationRequest,
) (*model.AnnoDoc, error)
AddAnnotation(na *annotation.NewTaggedAnnotation) (*model.AnnoDoc, error)
EditAnnotation(
ua *annotation.TaggedAnnotationUpdate,
) (*model.AnnoDoc, error)
RemoveAnnotation(id string, purge bool) error
// ListAnnotationGroup provides a paginated list of annotation along
// with optional filtering
ListAnnotations(*ListAnnotationsParams) ([]*model.AnnoDoc, error)
ClearAnnotations() error
Clear() error
// AddAnnotationGroup creates a new annotation group
AddAnnotationGroup(idslice ...string) (*model.AnnoGroup, error)
// GetAnnotationGroup retrieves an annotation group
GetAnnotationGroup(groupID string) (*model.AnnoGroup, error)
// AppendToAnnotationGroup adds new annotations to an existing group
AppendToAnnotationGroup(
groupID string,
idslice ...string,
) (*model.AnnoGroup, error)
// DeleteAnnotationGroup deletes an annotation group
RemoveAnnotationGroup(groupID string) error
// RemoveFromAnnotationGroup remove annotations from an existing group
RemoveFromAnnotationGroup(
groupID string,
idslice ...string,
) (*model.AnnoGroup, error)
// ListAnnotationGroup provides a paginated list of annotation groups along
// with optional filtering
ListAnnotationGroup(
cursor, limit int64,
filter string,
) ([]*model.AnnoGroup, error)
// GetAnnotationTag retrieves tag information
GetAnnotationTag(name, ontology string) (*model.AnnoTag, error)
Dbh() *manager.Database
LoadOboJSON(r io.Reader) (*storage.UploadInformation, error)
}
TaggedAnnotationRepository is an interface for accessing annotation data from its data sources.