indexdb

package module
v0.1.28 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2026 License: MIT Imports: 5 Imported by: 0

README

tinywasm/indexdb

Project Badges

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

Usage

db := indexdb.InitDB("my_db", idGenerator, logger, &User{}, &Product{})

This single-line initialization instantly yields a fully functioning *orm.DB ready for use with the github.com/tinywasm/orm API.

Contributing

Documentation

Rendered for js/wasm

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckCondition added in v0.1.28

func CheckCondition(val js.Value, cond orm.Condition) bool

CheckCondition checks if a JS value satisfies a condition

func InitDB added in v0.1.25

func InitDB(dbName string, idg idGenerator, logger func(...any), structTables ...any) *orm.DB

InitDB initializes the IndexedDB database and returns an *orm.DB instance.

func MapResult added in v0.1.28

func MapResult(val js.Value, m orm.Model) error

MapResult maps a JS value to a Model's pointers

func ProcessCursorRequest added in v0.1.28

func ProcessCursorRequest(req js.Value, onNext func(cursor js.Value) bool) error

ProcessCursorRequest handles an IndexedDB cursor request (openCursor). It iterates over the cursor and calls the provided callback for each item.

func ProcessRequest added in v0.1.28

func ProcessRequest(req js.Value) (js.Value, error)

ProcessRequest handles an IndexedDB request (like add, put, get, delete) and returns the result or error via channels.

Types

type IndexDBAdapter added in v0.1.24

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

func NewAdapter added in v0.1.24

func NewAdapter(dbName string, idg idGenerator, logger func(...any)) *IndexDBAdapter

NewAdapter creates a new IndexDBAdapter.

func (*IndexDBAdapter) Close added in v0.1.28

func (d *IndexDBAdapter) Close() error

Close implements orm.Executor

func (*IndexDBAdapter) Exec added in v0.1.28

func (d *IndexDBAdapter) Exec(query string, args ...any) error

Exec implements orm.Executor

func (*IndexDBAdapter) Execute added in v0.1.24

func (d *IndexDBAdapter) Execute(q orm.Query, m orm.Model, factory func() orm.Model, each func(orm.Model)) error

Execute implements orm.Adapter for IndexDB.

func (*IndexDBAdapter) GetNewID added in v0.1.24

func (d *IndexDBAdapter) GetNewID() string

Helper to access the ID generator

func (*IndexDBAdapter) Initialize added in v0.1.25

func (d *IndexDBAdapter) Initialize(structTables ...any)

Initialize initializes the IndexedDB database and creates object stores based on the provided structs.

func (*IndexDBAdapter) Query added in v0.1.28

func (d *IndexDBAdapter) Query(query string, args ...any) (orm.Rows, error)

Query implements orm.Executor

func (*IndexDBAdapter) QueryRow added in v0.1.28

func (d *IndexDBAdapter) QueryRow(query string, args ...any) orm.Scanner

QueryRow implements orm.Executor

func (*IndexDBAdapter) TableExist added in v0.1.24

func (d *IndexDBAdapter) TableExist(table_name string) bool

TableExist checks if a table exists in the database

type IndexDBCompiler added in v0.1.28

type IndexDBCompiler struct{}

Compiler converts ORM queries into engine instructions.

func (*IndexDBCompiler) Compile added in v0.1.28

func (c *IndexDBCompiler) Compile(q orm.Query, m orm.Model) (orm.Plan, error)

Jump to

Keyboard shortcuts

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