indexdb

package module
v0.1.15 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2025 License: MIT Imports: 4 Imported by: 0

README

indexdb

implementación de index dB con Websassembly compilado con go (golang)

Contributing

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Await added in v0.0.37

func Await(cb func() (js.Value, error)) js.Value

func CreateBlobURL added in v0.0.24

func CreateBlobURL(blob any) string

CreateBlobURL crea una URL Blob a partir de un blob.

func PromiseError added in v0.0.37

func PromiseError(e interface{}) (err js.Value)

PromiseError makes sure to return some error that Invoke will understand.

func PromiseOf added in v0.0.37

func PromiseOf(fn PromiseAbleFunc) js.Func

MakePromise hace una promesa de una función que toma una serie de argumentos.

Types

type IndexDB added in v0.1.6

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

func New added in v0.1.6

func New(dbName string, idg idGenerator, logger func(...any)) *IndexDB

New creates a new IndexDB instance with the given database name, ID generator, and logger.

type idGenerator interface {
	GetNewID() string
}

func (*IndexDB) ClearAllTableDataInDB added in v0.1.6

func (d *IndexDB) ClearAllTableDataInDB(tables ...string) (err error)

func (*IndexDB) Create added in v0.1.6

func (d *IndexDB) Create(table_name string, items ...any) (err error)

items support: []any (struct instances)

func (*IndexDB) CreateTableIfNotExists added in v0.1.6

func (d *IndexDB) CreateTableIfNotExists(tableName string, structType any) error

CreateTableIfNotExists creates a table for the given struct type if it doesn't exist

func (*IndexDB) Delete added in v0.1.6

func (d *IndexDB) Delete(table_name string, items ...any) (err error)

func (*IndexDB) InitDB added in v0.1.6

func (d *IndexDB) InitDB(structTables ...any)

InitDB require structs with interface structName { StructName() string } for table names eg: type User struct { NameField string } => User.StructName() string { return "user" } eg: type Product struct { NameField string } => Product.StructName() string { return "product" } then call: indexdb.InitDB(User{}, Product{}) This is because Reflect support is not complete, it is the only way this library can be compatible with TinyGo.

func (*IndexDB) Read added in v0.1.6

func (d *IndexDB) Read(p *ReadParams, callback func(r *ReadResults, err error))

func (*IndexDB) ReadStringDataInDB added in v0.1.6

func (d *IndexDB) ReadStringDataInDB(r *ReadParams) (out []interface{}, err error)

func (*IndexDB) ReadStringDataInDBold added in v0.1.6

func (d *IndexDB) ReadStringDataInDBold(r *ReadParams) (out []map[string]string, err error)

func (IndexDB) TableExist added in v0.1.6

func (d IndexDB) TableExist(table_name string) bool

TableExist checks if a table exists in the database

func (*IndexDB) Update added in v0.1.6

func (d *IndexDB) Update(table_name string, items ...any) (err error)

type PromiseAbleFunc added in v0.0.37

type PromiseAbleFunc = func(js.Value, []js.Value) (interface{}, error)

https://go-review.googlesource.com/c/go/+/402455/3/src/syscall/js/promise.go Función prometedora que satisface los requisitos de MakePromise.

type ReadParams added in v0.1.0

type ReadParams struct {
	FROM_TABLE string
	SORT_DESC  bool
	ID         string
	ORDER_BY   string
	WHERE      []interface{}
	RETURN_ANY bool
}

type ReadResults added in v0.1.0

type ReadResults struct {
	Results []interface{}
	Error   error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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