Versions in this module Expand all Collapse all v1 v1.3.5 Dec 6, 2024 v1.3.4 Mar 15, 2024 v1.3.3 Jan 26, 2024 v1.3.2 Oct 13, 2023 v1.3.1 Oct 13, 2023 v1.3.0 Feb 21, 2023 v1.2.1 Jan 31, 2023 v1.2.0 Feb 18, 2022 v1.1.0 Aug 3, 2021 Changes in this version + const ErrEmptyValue + const ErrMaxLength + const ErrWrongValue + const SearchTypeArray + const SearchTypeArrayContained + const SearchTypeArrayContains + const SearchTypeArrayIntersect + const SearchTypeEquals + const SearchTypeGE + const SearchTypeGreater + const SearchTypeILike + const SearchTypeJsonbPath + const SearchTypeLE + const SearchTypeLess + const SearchTypeLike + const SearchTypeNull + const StatusDeleted + const StatusDisabled + const StatusEnabled + const TableColumns + const TablePrefix + var Columns = struct{ ... } + var PagerDefault = Pager + var PagerNoLimit = Pager + var PagerOne = Pager + var PagerTwo = Pager + var StatusEnabledFilter = Filter + var StatusFilter = Filter + var Tables = struct{ ... } + type DB struct + func New(db *pg.DB) DB + func (db *DB) RunInLock(ctx context.Context, lockName string, fns ...func(*pg.Tx) error) error + func (db *DB) Version() (string, error) + func (db DB) CopyHashesFromSTDIN(tx *pg.Tx, r io.Reader) (int, error) + func (db DB) CreateTempHashesTable(ctx context.Context, tx *pg.Tx) error + func (db DB) UpsertHashesTable(ctx context.Context, tx *pg.Tx) (int, time.Duration, error) + type Filter struct + Exclude bool + Field string + SearchType int + Value interface{} + func (f Filter) Apply(query *orm.Query) *orm.Query + func (f Filter) String() string + type OpFunc func(query *orm.Query) + func EnabledOnly() OpFunc + func WithColumns(cols ...string) OpFunc + func WithJoinedIDs(ids []int, tableAlias, column string) OpFunc + func WithRelations(rels ...string) OpFunc + func WithSort(fields ...SortField) OpFunc + func WithTable(table string) OpFunc + type Pager struct + Page int + PageSize int + func NewPager(page, pageSize int) Pager + func (p Pager) Apply(query *orm.Query) *orm.Query + func (p Pager) Pager() *urlstruct.Pager + func (p Pager) String() (opts string) + type Searcher interface + Apply func(query *orm.Query) *orm.Query + Q func() applier + With func(condition string, params ...interface{}) + WithApply func(a applier) + type SortDirection string + const SortAsc + const SortAscNullsFirst + const SortAscNullsLast + const SortDesc + const SortDescNullsFirst + const SortDescNullsLast + type SortField struct + Column string + Direction SortDirection + func NewSortField(column string, sortDesc bool) SortField + type VfsFile struct + CreatedAt time.Time + FileExists bool + FileSize *int + Folder *VfsFolder + FolderID int + ID int + IsFavorite *bool + MimeType string + Params *VfsFileParams + Path string + StatusID int + Title string + func (vf VfsFile) Validate() (errors map[string]string, valid bool) + type VfsFileParams struct + Height int + Width int + type VfsFileSearch struct + CreatedAt *time.Time + FileExists *bool + FileSize *int + FolderID *int + ID *int + IDs []int + IsFavorite *bool + MimeType *string + MimeTypeILike *string + Params *VfsFileParams + Path *string + PathILike *string + StatusID *int + Title *string + TitleILike *string + func (s *VfsFileSearch) With(condition string, params ...interface{}) + func (s *VfsFileSearch) WithApply(a applier) + func (vfs *VfsFileSearch) Apply(query *orm.Query) *orm.Query + func (vfs *VfsFileSearch) Q() applier + func (vfs *VfsFileSearch) WithQuery(query *string) *VfsFileSearch + type VfsFolder struct + CreatedAt time.Time + ID int + IsFavorite *bool + ParentFolder *VfsFolder + ParentFolderID *int + StatusID int + Title string + func (vf VfsFolder) Validate() (errors map[string]string, valid bool) + type VfsFolderSearch struct + CreatedAt *time.Time + ID *int + IDs []int + IsFavorite *bool + ParentFolderID *int + StatusID *int + Title *string + TitleILike *string + func (s *VfsFolderSearch) With(condition string, params ...interface{}) + func (s *VfsFolderSearch) WithApply(a applier) + func (vfs *VfsFolderSearch) Apply(query *orm.Query) *orm.Query + func (vfs *VfsFolderSearch) Q() applier + type VfsHash struct + Blurhash *string + CreatedAt time.Time + Error string + Extension string + FileSize int + Hash string + Height int + IndexedAt *time.Time + Namespace string + Width int + func (vh VfsHash) Validate() (errors map[string]string, valid bool) + type VfsHashSearch struct + Blurhash *string + BlurhashILike *string + CreatedAt *time.Time + Error *string + ErrorILike *string + Extension *string + ExtensionILike *string + FileSize *int + Hash *string + HashILike *string + Hashes []string + Height *int + IndexedAt *time.Time + Namespace *string + NamespaceILike *string + Namespaces []string + Width *int + func (s *VfsHashSearch) With(condition string, params ...interface{}) + func (s *VfsHashSearch) WithApply(a applier) + func (vhs *VfsHashSearch) Apply(query *orm.Query) *orm.Query + func (vhs *VfsHashSearch) Q() applier + type VfsRepo struct + func NewVfsRepo(db orm.DB) VfsRepo + func (vr VfsRepo) AddVfsFile(ctx context.Context, vfsFile *VfsFile, ops ...OpFunc) (*VfsFile, error) + func (vr VfsRepo) AddVfsFolder(ctx context.Context, vfsFolder *VfsFolder, ops ...OpFunc) (*VfsFolder, error) + func (vr VfsRepo) AddVfsHash(ctx context.Context, vfsHash *VfsHash, ops ...OpFunc) (*VfsHash, error) + func (vr VfsRepo) CountVfsFiles(ctx context.Context, search *VfsFileSearch, ops ...OpFunc) (int, error) + func (vr VfsRepo) CountVfsFolders(ctx context.Context, search *VfsFolderSearch, ops ...OpFunc) (int, error) + func (vr VfsRepo) CountVfsHashes(ctx context.Context, search *VfsHashSearch, ops ...OpFunc) (int, error) + func (vr VfsRepo) DefaultVfsFileSort() OpFunc + func (vr VfsRepo) DefaultVfsFolderSort() OpFunc + func (vr VfsRepo) DefaultVfsHashSort() OpFunc + func (vr VfsRepo) DeleteVfsFile(ctx context.Context, id int) (deleted bool, err error) + func (vr VfsRepo) DeleteVfsFiles(ctx context.Context, fileIDs []int64) (bool, error) + func (vr VfsRepo) DeleteVfsFolder(ctx context.Context, id int) (deleted bool, err error) + func (vr VfsRepo) DeleteVfsHash(ctx context.Context, hash string, namespace string) (deleted bool, err error) + func (vr VfsRepo) FolderBranch(ctx context.Context, folderId int) (list []VfsFolder, err error) + func (vr VfsRepo) FullVfsFile() OpFunc + func (vr VfsRepo) FullVfsFolder() OpFunc + func (vr VfsRepo) FullVfsHash() OpFunc + func (vr VfsRepo) HashesForUpdate(ctx context.Context, limit uint64) (list []VfsHash, err error) + func (vr VfsRepo) NextFileID() (int, error) + func (vr VfsRepo) OneVfsFile(ctx context.Context, search *VfsFileSearch, ops ...OpFunc) (*VfsFile, error) + func (vr VfsRepo) OneVfsFolder(ctx context.Context, search *VfsFolderSearch, ops ...OpFunc) (*VfsFolder, error) + func (vr VfsRepo) OneVfsHash(ctx context.Context, search *VfsHashSearch, ops ...OpFunc) (*VfsHash, error) + func (vr VfsRepo) SaveVfsHash(ctx context.Context, hash *VfsHash) (err error) + func (vr VfsRepo) UpdateFilesFolder(ctx context.Context, fileIDs []int64, newFolderId int) (bool, error) + func (vr VfsRepo) UpdateVfsFile(ctx context.Context, vfsFile *VfsFile, ops ...OpFunc) (bool, error) + func (vr VfsRepo) UpdateVfsFolder(ctx context.Context, vfsFolder *VfsFolder, ops ...OpFunc) (bool, error) + func (vr VfsRepo) UpdateVfsHash(ctx context.Context, vfsHash *VfsHash, ops ...OpFunc) (bool, error) + func (vr VfsRepo) VfsFileByID(ctx context.Context, id int, ops ...OpFunc) (*VfsFile, error) + func (vr VfsRepo) VfsFilesByFilters(ctx context.Context, search *VfsFileSearch, pager Pager, ops ...OpFunc) (vfsFiles []VfsFile, err error) + func (vr VfsRepo) VfsFolderByID(ctx context.Context, id int, ops ...OpFunc) (*VfsFolder, error) + func (vr VfsRepo) VfsFoldersByFilters(ctx context.Context, search *VfsFolderSearch, pager Pager, ops ...OpFunc) (vfsFolders []VfsFolder, err error) + func (vr VfsRepo) VfsHashByID(ctx context.Context, hash string, namespace string, ops ...OpFunc) (*VfsHash, error) + func (vr VfsRepo) VfsHashesByFilters(ctx context.Context, search *VfsHashSearch, pager Pager, ops ...OpFunc) (vfsHashes []VfsHash, err error) + func (vr VfsRepo) WithEnabledOnly() VfsRepo + func (vr VfsRepo) WithTransaction(tx *pg.Tx) VfsRepo