Versions in this module Expand all Collapse all v0 v0.5.0 Dec 10, 2022 v0.4.1 Mar 26, 2022 v0.4.0 Mar 25, 2022 Changes in this version type FS + func NewInMemoryFS() FS v0.3.0 Mar 17, 2022 Changes in this version type ImmutableFS + ReadOnly func() bool v0.2.0 Mar 16, 2022 Changes in this version type FS + func NilFS() FS v0.1.0 Mar 5, 2022 Changes in this version + var ErrNoSuchId = errors.New("attachments: No such Id") + var ErrReadOnly = errors.New("attachments: read-only") + type Entry struct + Checksum string + Id int64 + Name string + OwnerId int64 + Size int64 + Ts int64 + func (e *Entry) FormatSize() string + func (e *Entry) FormatTime() string + func (e *Entry) Path() string + type FS interface + Exists func(name string) bool + Open func(name string) (io.ReadCloser, error) + Write func(name string) (io.WriteCloser, error) + func NewFS(root string) FS + type FakeFS map[string][]byte + func (f FakeFS) Exists(name string) bool + func (f FakeFS) Open(name string) (io.ReadCloser, error) + func (f FakeFS) Write(name string) (io.WriteCloser, error) + type ImmutableFS struct + func NewImmutableFS(fileSystem FS, store Store, owner Owner, options ...Option) *ImmutableFS + func (f *ImmutableFS) List(t db.Transaction, ids map[int64]bool) ([]Entry, error) + func (f *ImmutableFS) Open(name string) (fs.File, error) + func (f *ImmutableFS) Write(name string, contents []byte) (int64, error) + type Option interface + func ReadOnly() Option + type Owner struct + Id int64 + Key []byte + type Store interface + AddEntry func(t db.Transaction, entry *Entry) error + EntryById func(t db.Transaction, id, ownerId int64, entry *Entry) error + func NewFakeStore() Store