Documentation
¶
Overview ¶
Package file implements the AWS File storage.
Index ¶
- Constants
- func Get() storage.IStorage
- func Set(s storage.IStorage)
- type CreateAny
- type File
- func (s *File) Count(ctx context.Context, target string, prm *count.Count, ...) (int64, error)
- func (s *File) Create(ctx context.Context, id, target string, v any, prm *create.Create, ...) (string, error)
- func (s *File) Delete(ctx context.Context, id, target string, prm *delete.Delete, ...) error
- func (s *File) GetClient() any
- func (s *File) List(ctx context.Context, target string, v any, prm *list.List, ...) error
- func (s *File) Retrieve(ctx context.Context, id, target string, v any, prm *retrieve.Retrieve, ...) error
- func (s *File) Update(ctx context.Context, id, target string, v any, prm *update.Update, ...) error
- type ResponseListKeys
Constants ¶
View Source
const Name = "file"
Name of the storage.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CreateAny ¶
type CreateAny struct {
// Create directory and file if it does not exist.
CreateIfNotExist bool `default:"true" json:"create_if_not_exist"`
}
CreateAny is a struct for the `create.Create` `Any` field.
type File ¶
type File struct {
*storage.Storage
// Target allows to set a static target. If it is empty, the target will be
// dynamic - the one set at the operation (count, create, delete, etc) time.
// Depending on the storage, target is a collection, a table, a bucket, etc.
// For ElasticSearch, for example it doesn't have a concept of a database -
// the target then is the index. Due to different cases of ElasticSearch
// usage, the target can be static or dynamic - defined at the index time,
// for example: log-{YYYY}-{MM}. For File, it isn't used at all.
Target string `json:"-" validate:"omitempty,gt=0"`
}
File storage definition.
func (*File) Count ¶
func (s *File) Count(ctx context.Context, target string, prm *count.Count, options ...storage.Func[*count.Count]) (int64, error)
Count returns the number of items in the storage.
func (*File) Create ¶
func (s *File) Create(ctx context.Context, id, target string, v any, prm *create.Create, options ...storage.Func[*create.Create]) (string, error)
Create data.
NOTE: Not all storages returns the ID, neither all storages requires `id` to be set. You are better off setting the ID yourself.
func (*File) Delete ¶
func (s *File) Delete(ctx context.Context, id, target string, prm *delete.Delete, options ...storage.Func[*delete.Delete]) error
Delete removes data.
func (*File) List ¶
func (s *File) List(ctx context.Context, target string, v any, prm *list.List, options ...storage.Func[*list.List]) error
List data.
NOTE: It uses params.List.Search to query the data.
NOTE: File does not support the concept of "offset" and "limit" in the same way that a traditional SQL database does.
type ResponseListKeys ¶
type ResponseListKeys struct {
Keys []string `json:"keys"`
}
ResponseListKeys is the response from the Redis list SCAN command.
Click to show internal directories.
Click to hide internal directories.