Documentation
¶
Rendered for js/wasm
Overview ¶
Package idb implements the billy.Filesystem interface backed by IndexedDB store. It is only usable in a js/wasm build targeting a browser environment. https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API
Index ¶
- type IDBFile
- func (f *IDBFile) Close() error
- func (f *IDBFile) Lock() error
- func (f *IDBFile) Name() string
- func (f *IDBFile) Read(p []byte) (int, error)
- func (f *IDBFile) ReadAt(p []byte, off int64) (x int, err error)
- func (f *IDBFile) Seek(offset int64, whence int) (int64, error)
- func (f *IDBFile) Truncate(size int64) error
- func (f *IDBFile) Unlock() error
- func (f *IDBFile) Write(p []byte) (int, error)
- func (f *IDBFile) WriteAt(p []byte, off int64) (s int, err error)
- type IDBFileInfo
- type IndexedDB
- func (idb *IndexedDB) Chroot(path string) (billy.Filesystem, error)
- func (idb *IndexedDB) Create(filename string) (billy.File, error)
- func (idb *IndexedDB) Join(elem ...string) string
- func (idb *IndexedDB) Lstat(filename string) (os.FileInfo, error)
- func (idb *IndexedDB) MkdirAll(p string, perm os.FileMode) error
- func (idb *IndexedDB) Open(filename string) (billy.File, error)
- func (idb *IndexedDB) OpenFile(filename string, flag int, perm os.FileMode) (billy.File, error)
- func (idb *IndexedDB) ReadDir(p string) ([]os.FileInfo, error)
- func (idb *IndexedDB) Readlink(link string) (string, error)
- func (idb *IndexedDB) Remove(name string) error
- func (idb *IndexedDB) Rename(oldpath, newpath string) error
- func (idb *IndexedDB) Root() string
- func (idb *IndexedDB) Stat(name string) (os.FileInfo, error)
- func (idb *IndexedDB) Symlink(target, link string) error
- func (idb *IndexedDB) TempFile(dir, prefix string) (billy.File, error)
- type Operation
- type Transaction
- func (tx *Transaction) Commit(db js.Value) error
- func (tx *Transaction) Delete(store, key string) *Operation
- func (tx *Transaction) Get(store, key string) *Operation
- func (tx *Transaction) GetAllKeys(store string, query js.Value) *Operation
- func (tx *Transaction) Put(store, key string, value js.Value) *Operation
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type IDBFileInfo ¶
type IDBFileInfo struct {
// contains filtered or unexported fields
}
func FileInfoFromJS ¶
func FileInfoFromJS(jsVal js.Value) *IDBFileInfo
Converts a JS Object into a IDBFileInfo struct.
func (*IDBFileInfo) IsDir ¶
func (fi *IDBFileInfo) IsDir() bool
func (*IDBFileInfo) ModTime ¶
func (fi *IDBFileInfo) ModTime() time.Time
func (*IDBFileInfo) Mode ¶
func (fi *IDBFileInfo) Mode() os.FileMode
func (*IDBFileInfo) Name ¶
func (fi *IDBFileInfo) Name() string
func (*IDBFileInfo) Size ¶
func (fi *IDBFileInfo) Size() int64
func (*IDBFileInfo) Sys ¶
func (fi *IDBFileInfo) Sys() any
func (*IDBFileInfo) Type ¶
func (fi *IDBFileInfo) Type() fs.FileMode
type IndexedDB ¶
type IndexedDB struct {
// contains filtered or unexported fields
}
type Transaction ¶
type Transaction struct {
// contains filtered or unexported fields
}
func NewTx ¶
func NewTx() *Transaction
Creates a transaction-like interface. The real JS IDB tx is created and commited inside Tx.Commit().
func (*Transaction) Commit ¶
func (tx *Transaction) Commit(db js.Value) error
It creates the real JS IDB tx, runs all the queued request/queries and waits for them to finish.
func (*Transaction) Delete ¶
func (tx *Transaction) Delete(store, key string) *Operation
JS: store.delete(key)
func (*Transaction) Get ¶
func (tx *Transaction) Get(store, key string) *Operation
JS: store.get(key)
func (*Transaction) GetAllKeys ¶
func (tx *Transaction) GetAllKeys(store string, query js.Value) *Operation
JS: store.getAllKeys(query)
Click to show internal directories.
Click to hide internal directories.