meta

package
v0.0.0-...-77d2946 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2024 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SortFieldName       = SortField("name")
	SortFieldCreateTime = SortField("createTime")

	SortOrderAscending  = SortOrder("ascending")
	SortOrderDescending = SortOrder("descending")
)

Variables

View Source
var BaseDirectory string

BaseDirectory the data directory

View Source
var ErrMetaDataNotFound = errors.New(2_000_000, "metadata for '%s' not found.")

Functions

func Count

func Count(ctx context.Context, client *ent.Client, q QueryParams) (count int, err error)

func CreateQuery

func CreateQuery(ctx context.Context, client *ent.Client, q QueryParams) (query *ent.MetaQuery, err error)

func GenerateImageIndices

func GenerateImageIndices(m *ent.Meta) error

func GenerateThumbnail

func GenerateThumbnail(m *ent.Meta, fileIndex int, details CropDetails) error

func IsItemExist

func IsItemExist(ctx context.Context, client *ent.Client, name string) bool

func ListDir

func ListDir(path string) (files []string, err error)

ListDir returns a list of content of a directory.

func NewItem

func NewItem(ctx context.Context, client *ent.Client, name string) (i *ent.Meta, err error)

func Open

func Open(m *ent.Meta) (reader io.ReadCloser, err error)

func PopulateTags

func PopulateTags(ctx context.Context, client *ent.Client, m *ent.Meta) (out *ent.Meta, err error)

func Read

func Read(ctx context.Context, client *ent.Client, name string) (m *ent.Meta, err error)

func ReadAll

func ReadAll(ctx context.Context, client *ent.Client) (items []*ent.Meta, err error)

func ReadPage

func ReadPage(ctx context.Context, client *ent.Client, q QueryParams) (items []*ent.Meta, err error)

func Write

func Write(ctx context.Context, client *ent.Client, m *ent.Meta) error

Types

type CropDetails

type CropDetails struct {
	X      int `json:"x"`
	Y      int `json:"y"`
	Width  int `json:"width"`
	Height int `json:"height"`
}

type QueryParams

type QueryParams struct {
	SearchName   string
	SearchTag    string
	SortBy       SortField
	SortOrder    SortOrder
	FavoriteOnly bool
	Page         int
	ItemPerPage  int
}

type SortField

type SortField string

type SortOrder

type SortOrder string

Jump to

Keyboard shortcuts

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