New Search Job code. Supports filtering and sorting. Renaming apiBlockRecordFile -> apiFile. Added filters and sort parameters to /search/result.

Improved API documentation. Added documentation about search filters and sort parameter.
This commit is contained in:
Kleissner
2021-10-05 10:50:04 +02:00
parent b79b0d2194
commit 2451fdafb1
9 changed files with 603 additions and 231 deletions

View File

@@ -32,7 +32,9 @@ const (
// Date returns the tags data as date encoded
func (tag *BlockRecordFileTag) Date() (time.Time, error) {
if len(tag.Data) != 8 {
if tag == nil {
return time.Time{}, errors.New("tag not available")
} else if len(tag.Data) != 8 {
return time.Time{}, errors.New("file tag date invalid size")
}
@@ -89,3 +91,14 @@ func IsTagVirtual(Type uint16) bool {
return false
}
}
// GetTag returns the tag with the type or nil if not available.
func (file *BlockRecordFile) GetTag(Type uint16) (tag *BlockRecordFileTag) {
for n := range file.Tags {
if file.Tags[n].Type == Type {
return &file.Tags[n]
}
}
return nil
}