Documentation ¶
Index ¶
- func AssetIDListToUint64List(assetIDList []AssetID) (idList []uint64)
- type Asset
- func (a *Asset) CanBeUpdatedBy(asset *Asset) (ok bool, reason string)
- func (a *Asset) GetID() uint64
- func (a *Asset) HasAnyOneOfTagID(tagSet *TagSet) bool
- func (a *Asset) HasID() bool
- func (a *Asset) HasPath() bool
- func (a *Asset) HasTag(tagID TagID) bool
- func (a *Asset) IsAddable() (bool, string)
- func (a *Asset) IsSavable() bool
- func (a *Asset) IsUpdatableByID() bool
- func (a *Asset) SetID(id uint64)
- func (a *Asset) ToCSVRow(tagSet *TagSet) (string, error)
- func (a *Asset) ToJson() (string, error)
- func (a *Asset) UpdateBy(asset *Asset) error
- func (a *Asset) Validate() error
- type AssetID
- type BoundingBox
- type BoundingBoxID
- type BoundingBoxes
- type ImportAsset
- type ImportBoundingBox
- type Query
- type QueryOP
- type Tag
- type TagID
- type TagSet
- func (t *TagSet) Get(id TagID) (*Tag, bool)
- func (t *TagSet) GetByName(name string) (*Tag, bool)
- func (t *TagSet) Set(tag *Tag) bool
- func (t *TagSet) SplitBy(f func(tag *Tag) bool) (trueTagSet, falseTagSet *TagSet)
- func (t *TagSet) SplitByID(idList []TagID) (existsTagSet, nonExistsTagSet *TagSet)
- func (t *TagSet) SplitByNames(names []string) (existsTagSet, nonExistsTagSet *TagSet)
- func (t *TagSet) SubSetBy(f func(tag *Tag) bool) *TagSet
- func (t *TagSet) SubSetByID(idList []TagID) *TagSet
- func (t *TagSet) SubSetByNames(names []string) *TagSet
- func (t *TagSet) ToMap() (map[TagID]*Tag, map[string]*Tag)
- func (t *TagSet) ToTags() (tags []*Tag)
- type UnindexedTag
- type UnregisteredTag
- type UnregisteredUnindexedTag
- type WSName
- type WorkSpace
- type WorkSpaceID
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssetIDListToUint64List ¶
Types ¶
type Asset ¶
type Asset struct { ID AssetID `json:"id,omitempty"` Name string `json:"name"` Path string `json:"path"` BoundingBoxes []*BoundingBox `json:"boundingBoxes"` }
func NewAssetFromBytes ¶ added in v0.1.3
func NewAssetFromFilePath ¶
func (*Asset) CanBeUpdatedBy ¶ added in v0.1.6
func (*Asset) HasAnyOneOfTagID ¶
func (*Asset) IsUpdatableByID ¶ added in v0.1.3
IsUpdatableByID checks if this asset can be updated. If asset or box which the asset has does not have ID, the asset is not updatable.
type BoundingBox ¶
type BoundingBox struct { ID BoundingBoxID `json:"id"` TagID TagID `json:"tagID"` X int `json:"x"` Y int `json:"y"` Width int `json:"width"` Height int `json:"height"` }
func RemoveBoundingBoxByID ¶
func RemoveBoundingBoxByID(boxes []*BoundingBox, replaceBoxID BoundingBoxID) (newBoxes []*BoundingBox)
func ReplaceBoundingBoxByID ¶
func ReplaceBoundingBoxByID(boxes []*BoundingBox, replaceBox *BoundingBox) (newBoxes []*BoundingBox)
func (*BoundingBox) HasID ¶ added in v0.1.3
func (b *BoundingBox) HasID() bool
func (*BoundingBox) HasTagID ¶ added in v0.1.3
func (b *BoundingBox) HasTagID() bool
func (*BoundingBox) IsSame ¶ added in v0.1.3
func (b *BoundingBox) IsSame(box *BoundingBox) bool
IsSame checks if tow boxes are the same. This method ignore ID.
type BoundingBoxID ¶
type BoundingBoxID uint64
type BoundingBoxes ¶ added in v0.1.3
type BoundingBoxes []*BoundingBox
func (BoundingBoxes) HasSameBox ¶ added in v0.1.3
func (boxes BoundingBoxes) HasSameBox(box *BoundingBox) bool
func (BoundingBoxes) Merge ¶ added in v0.1.3
func (boxes BoundingBoxes) Merge(otherBoxes []*BoundingBox) []*BoundingBox
Merge merge boxes
type ImportAsset ¶ added in v0.1.1
type ImportAsset struct { *Asset `mapstructure:",squash"` BoundingBoxes []*ImportBoundingBox `json:"boundingBoxes"` }
func NewImportAsset ¶ added in v0.1.6
func NewImportAsset(id AssetID, path string, boxes []*ImportBoundingBox) *ImportAsset
func NewImportAssetFromFilePath ¶ added in v0.1.1
func NewImportAssetFromFilePath(filePath string) *ImportAsset
func NewImportAssetFromJson ¶ added in v0.1.3
func NewImportAssetFromJson(contents []byte) (*ImportAsset, error)
func (*ImportAsset) ToAsset ¶ added in v0.1.1
func (a *ImportAsset) ToAsset(tagSet *TagSet) (*Asset, error)
func (*ImportAsset) Validate ¶ added in v0.1.3
func (a *ImportAsset) Validate(tagSet *TagSet) error
type ImportBoundingBox ¶ added in v0.1.1
type ImportBoundingBox struct { *BoundingBox `mapstructure:",squash"` TagName string `json:"tagName"` }
func NewImportBoundingBoxFromTagID ¶ added in v0.1.6
func NewImportBoundingBoxFromTagID(tagID TagID) *ImportBoundingBox
func (*ImportBoundingBox) HasTagName ¶ added in v0.1.3
func (b *ImportBoundingBox) HasTagName() bool
func (*ImportBoundingBox) Validate ¶ added in v0.1.3
func (b *ImportBoundingBox) Validate(tagSet *TagSet) error
type Tag ¶
type Tag struct { *UnindexedTag Index int `json:"index"` }
func (*Tag) ReRegister ¶ added in v0.1.4
func (*Tag) SafeUnregister ¶ added in v0.1.4
func (t *Tag) SafeUnregister() (*UnregisteredTag, error)
func (*Tag) Unindex ¶ added in v0.1.5
func (t *Tag) Unindex() *UnindexedTag
func (*Tag) Unregister ¶ added in v0.1.4
func (t *Tag) Unregister() *UnregisteredTag
type TagID ¶
type TagID uint64
func BoxesToTagIDList ¶ added in v0.1.3
func BoxesToTagIDList(boxes []*BoundingBox) (idList []TagID)
type TagSet ¶
type TagSet struct {
// contains filtered or unexported fields
}
func (*TagSet) Set ¶
Set set tag. If provided tag does not exists yet, set the tag and return true. If provided tag name already exists on TagSet and has different ID, do nothing and return false. Otherwise, add or update the tag, and return true. If provided tag already exists but has different ID, update the tag and return true. Otherwise do nothing and returns false.
func (*TagSet) SplitBy ¶ added in v0.1.4
SplitBy splits TagSet to two sub sets based on return value of provided function.
func (*TagSet) SplitByID ¶ added in v0.1.4
SplitByID splits TagSet to two sub sets based on provided tag ID.
func (*TagSet) SplitByNames ¶ added in v0.1.4
SplitByNames splits TagSet to two sub sets based on provided tag names.
func (*TagSet) SubSetByID ¶ added in v0.1.4
SubSetByID returns sub TagSet. new TagSet contains tag which have either provided ID.
func (*TagSet) SubSetByNames ¶ added in v0.1.4
SubSetByNames returns sub TagSet. new TagSet contains tag which have either provided names.
type UnindexedTag ¶ added in v0.1.4
func NewUnindexedTag ¶ added in v0.1.4
func NewUnindexedTag(id TagID, name string) (*UnindexedTag, error)
NewUnindexedTag construct and returns UnindexedTag
func (*UnindexedTag) GetID ¶ added in v0.1.4
func (t *UnindexedTag) GetID() uint64
func (*UnindexedTag) SafeUnregister ¶ added in v0.1.4
func (t *UnindexedTag) SafeUnregister() (*UnregisteredUnindexedTag, error)
func (*UnindexedTag) SetID ¶ added in v0.1.4
func (t *UnindexedTag) SetID(id uint64)
func (*UnindexedTag) Unregister ¶ added in v0.1.4
func (t *UnindexedTag) Unregister() *UnregisteredUnindexedTag
type UnregisteredTag ¶ added in v0.1.4
type UnregisteredTag struct { *UnregisteredUnindexedTag Index int }
func NewUnregisteredTag ¶ added in v0.1.4
func NewUnregisteredTag(name string, index int) (*UnregisteredTag, error)
NewUnregisteredTag construct and return UnregisteredTag
func NewUnregisteredTagWithIndexFromUnregisteredTag ¶ added in v0.1.4
func NewUnregisteredTagWithIndexFromUnregisteredTag(tag *UnregisteredUnindexedTag, index int) (*UnregisteredTag, error)
NewUnregisteredTagWithIndexFromUnregisteredTag construct and return UnregisteredTag from UnregisteredUnindexedTag
func (*UnregisteredTag) Register ¶ added in v0.1.4
func (t *UnregisteredTag) Register(id TagID) *Tag
type UnregisteredUnindexedTag ¶ added in v0.1.4
type UnregisteredUnindexedTag struct {
Name string
}
func NewUnregisteredUnindexedTag ¶ added in v0.1.4
func NewUnregisteredUnindexedTag(name string) (*UnregisteredUnindexedTag, error)
NewUnregisteredUnindexedTag construct and returns UnregisteredUnindexedTag
func (*UnregisteredUnindexedTag) Register ¶ added in v0.1.4
func (t *UnregisteredUnindexedTag) Register(id TagID) *UnindexedTag
type WorkSpace ¶
type WorkSpace struct { ID WorkSpaceID `json:"id"` Name WSName `json:"name"` BasePath string `json:"basePath"` }
type WorkSpaceID ¶
type WorkSpaceID uint64