idb

package
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 2, 2026 License: AGPL-3.0 Imports: 11 Imported by: 0

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

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IDBFile

type IDBFile struct {
	// contains filtered or unexported fields
}

func (*IDBFile) Close

func (f *IDBFile) Close() error

func (*IDBFile) Lock

func (f *IDBFile) Lock() error

func (*IDBFile) Name

func (f *IDBFile) Name() string

func (*IDBFile) Read

func (f *IDBFile) Read(p []byte) (int, error)

func (*IDBFile) ReadAt

func (f *IDBFile) ReadAt(p []byte, off int64) (x int, err error)

func (*IDBFile) Seek

func (f *IDBFile) Seek(offset int64, whence int) (int64, error)

func (*IDBFile) Truncate

func (f *IDBFile) Truncate(size int64) error

func (*IDBFile) Unlock

func (f *IDBFile) Unlock() error

func (*IDBFile) Write

func (f *IDBFile) Write(p []byte) (int, error)

func (*IDBFile) WriteAt

func (f *IDBFile) WriteAt(p []byte, off int64) (s int, err error)

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
}

func New

func New(name string, version int) (*IndexedDB, error)

func (*IndexedDB) Chroot

func (idb *IndexedDB) Chroot(path string) (billy.Filesystem, error)

func (*IndexedDB) Create

func (idb *IndexedDB) Create(filename string) (billy.File, error)

func (*IndexedDB) Join

func (idb *IndexedDB) Join(elem ...string) string

func (*IndexedDB) Lstat

func (idb *IndexedDB) Lstat(filename string) (os.FileInfo, error)

func (*IndexedDB) MkdirAll

func (idb *IndexedDB) MkdirAll(p string, perm os.FileMode) error

func (*IndexedDB) Open

func (idb *IndexedDB) Open(filename string) (billy.File, error)

func (*IndexedDB) OpenFile

func (idb *IndexedDB) OpenFile(filename string, flag int, perm os.FileMode) (billy.File, error)

func (*IndexedDB) ReadDir

func (idb *IndexedDB) ReadDir(p string) ([]os.FileInfo, error)
func (idb *IndexedDB) Readlink(link string) (string, error)

func (*IndexedDB) Remove

func (idb *IndexedDB) Remove(name string) error

func (*IndexedDB) Rename

func (idb *IndexedDB) Rename(oldpath, newpath string) error

func (*IndexedDB) Root

func (idb *IndexedDB) Root() string

func (*IndexedDB) Stat

func (idb *IndexedDB) Stat(name string) (os.FileInfo, error)
func (idb *IndexedDB) Symlink(target, link string) error

func (*IndexedDB) TempFile

func (idb *IndexedDB) TempFile(dir, prefix string) (billy.File, error)

type Operation

type Operation struct {
	// contains filtered or unexported fields
}

func (*Operation) Result

func (op *Operation) Result() js.Value

Result simply returns the stored value, safe to call multiple times.

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)

func (*Transaction) Put

func (tx *Transaction) Put(store, key string, value js.Value) *Operation

JS: store.put(value, key)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL