Documentation
¶
Index ¶
- func Await(cb func() (js.Value, error)) js.Value
- func CreateBlobURL(blob any) string
- func PromiseError(e interface{}) (err js.Value)
- func PromiseOf(fn PromiseAbleFunc) js.Func
- type IndexDB
- func (d *IndexDB) ClearAllTableDataInDB(tables ...string) (err error)
- func (d *IndexDB) Create(table_name string, items ...any) (err error)
- func (d *IndexDB) CreateTableIfNotExists(tableName string, structType any) error
- func (d *IndexDB) Delete(table_name string, items ...any) (err error)
- func (d *IndexDB) InitDB(structTables ...any)
- func (d *IndexDB) Read(p *ReadParams, callback func(r *ReadResults, err error))
- func (d *IndexDB) ReadStringDataInDB(r *ReadParams) (out []interface{}, err error)
- func (d *IndexDB) ReadStringDataInDBold(r *ReadParams) (out []map[string]string, err error)
- func (d IndexDB) TableExist(table_name string) bool
- func (d *IndexDB) Update(table_name string, items ...any) (err error)
- type PromiseAbleFunc
- type ReadParams
- type ReadResults
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateBlobURL ¶ added in v0.0.24
CreateBlobURL crea una URL Blob a partir de un blob.
func PromiseError ¶ added in v0.0.37
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
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 (*IndexDB) CreateTableIfNotExists ¶ added in v0.1.6
CreateTableIfNotExists creates a table for the given struct type if it doesn't exist
func (*IndexDB) InitDB ¶ added in v0.1.6
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
TableExist checks if a table exists in the database
type PromiseAbleFunc ¶ added in v0.0.37
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 ReadResults ¶ added in v0.1.0
type ReadResults struct {
Results []interface{}
Error error
}