Documentation
¶
Index ¶
- Constants
- type NewStoreOptions
- type Record
- func (o *Record) Contents() string
- func (o *Record) CreatedAt() string
- func (o *Record) DeletedAt() string
- func (o *Record) Extension() string
- func (o *Record) ID() string
- func (o *Record) IsDirectory() bool
- func (o *Record) IsFile() bool
- func (o *Record) Name() string
- func (o *Record) ParentID() string
- func (o *Record) Path() string
- func (o *Record) SetContents(fileContents string) *Record
- func (o *Record) SetCreatedAt(createdAt string) *Record
- func (o *Record) SetDeletedAt(deletedAt string) *Record
- func (o *Record) SetExtension(extension string) *Record
- func (o *Record) SetID(id string) *Record
- func (o *Record) SetName(name string) *Record
- func (o *Record) SetParentID(parentID string) *Record
- func (o *Record) SetPath(filePath string) *Record
- func (o *Record) SetSize(fileSize string) *Record
- func (o *Record) SetType(fileType string) *Record
- func (o *Record) SetUpdatedAt(updatedAt string) *Record
- func (o *Record) Size() string
- func (o *Record) Type() string
- func (o *Record) UpdatedAt() string
- type RecordQueryOptions
- type Store
- func (store *Store) AutoMigrate(ctx context.Context) error
- func (st *Store) EnableDebug(debug bool)
- func (st *Store) RecordCount(ctx context.Context, options RecordQueryOptions) (int64, error)
- func (store *Store) RecordCreate(ctx context.Context, record *Record) error
- func (store *Store) RecordDelete(ctx context.Context, record *Record) error
- func (store *Store) RecordDeleteByID(ctx context.Context, id string) error
- func (store *Store) RecordFindByID(ctx context.Context, id string, options RecordQueryOptions) (*Record, error)
- func (store *Store) RecordFindByPath(ctx context.Context, path string, options RecordQueryOptions) (*Record, error)
- func (store *Store) RecordList(ctx context.Context, options RecordQueryOptions) ([]Record, error)
- func (store *Store) RecordRecalculatePath(ctx context.Context, record *Record, parentRecord *Record) error
- func (store *Store) RecordSoftDelete(ctx context.Context, record *Record) error
- func (store *Store) RecordSoftDeleteByID(ctx context.Context, id string) error
- func (store *Store) RecordUpdate(ctx context.Context, record *Record) error
Constants ¶
View Source
const COLUMN_CONTENTS = "contents"
View Source
const COLUMN_CREATED_AT = "created_at"
View Source
const COLUMN_DELETED_AT = "deleted_at"
View Source
const COLUMN_EXTENSION = "extension"
View Source
const COLUMN_ID = "id"
View Source
const COLUMN_NAME = "name"
View Source
const COLUMN_PARENT_ID = "parent_id"
View Source
const COLUMN_PATH = "path"
View Source
const COLUMN_SIZE = "size"
View Source
const COLUMN_TYPE = "type"
View Source
const COLUMN_UPDATED_AT = "updated_at"
View Source
const PATH_SEPARATOR = "/"
View Source
const ROOT_ID = "0"
View Source
const ROOT_PATH = PATH_SEPARATOR
View Source
const TYPE_DIRECTORY = "directory"
View Source
const TYPE_FILE = "file"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type NewStoreOptions ¶
type NewStoreOptions struct {
TableName string
DB *sql.DB
DbDriverName string
AutomigrateEnabled bool
DebugEnabled bool
}
NewStoreOptions define the options for creating a new block store
type Record ¶
type Record struct {
dataobject.DataObject
}
func NewDirectory ¶
func NewDirectory() *Record
func (*Record) IsDirectory ¶
func (*Record) SetContents ¶
func (*Record) SetCreatedAt ¶
func (*Record) SetDeletedAt ¶
func (*Record) SetExtension ¶
func (*Record) SetParentID ¶
func (*Record) SetPath ¶
SetPath sets the file path. As all paths must start with "/" adds a "/" if not present. Any trailing spaces is also trimmed
func (*Record) SetUpdatedAt ¶
type RecordQueryOptions ¶
type RecordQueryOptions struct {
ID string
IDIn []string
ParentID string
Type string
Path string
PathStartsWith string
CreatedAtLessThan string
CreatedAtGreaterThan string
UpdatedAtLessThan string
UpdatedAtGreaterThan string
Columns []string
Offset int
Limit int
SortOrder string
OrderBy string
CountOnly bool
WithSoftDeleted bool
}
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
func NewStore ¶
func NewStore(opts NewStoreOptions) (*Store, error)
NewStore creates a new block store
func (*Store) AutoMigrate ¶
AutoMigrate auto migrate
func (*Store) EnableDebug ¶
EnableDebug - enables the debug option
func (*Store) RecordCount ¶
func (*Store) RecordCreate ¶
func (*Store) RecordDelete ¶
func (*Store) RecordDeleteByID ¶
func (*Store) RecordFindByID ¶
func (*Store) RecordFindByPath ¶
func (*Store) RecordList ¶
func (*Store) RecordRecalculatePath ¶
func (*Store) RecordSoftDelete ¶
func (*Store) RecordSoftDeleteByID ¶
Click to show internal directories.
Click to hide internal directories.