Ultra-lightweight, strongly-typed ORM engineered for WebAssembly and backend environments.
// modules/user/model.go
package user
type User struct {
ID string `db:"pk" json:"id"`
Name string `json:"name"`
Email string `db:"unique" json:"email" form:"email"`
Bio string `form:"textarea" json:"bio,omitempty"`
}Run ormc from your project root.
go install github.com/tinywasm/orm/cmd/ormc@latest
ormcThis generates modules/user/model_orm.go with the Model implementation and typed helpers.
Tip
Automatic Sync: ormc automatically runs go get for required dependencies and go mod tidy if a go.mod is detected.
import (
"github.com/tinywasm/orm"
"yourproject/modules/user"
)
func GetActiveUsers(db *orm.DB) ([]*user.User, error) {
return user.ReadAllUser(
db.Query(&user.User{}).
Where(user.User_.Email).Like("%@gmail.com").
Limit(10),
)
}- Standard Library Only: No external assertion libraries or heavy dependencies.
- Isomorphic & Agnostic: Works identically in Go (backend) and WASM (frontend). Generated code contains no build tags.
- Interface over Reflection: Zero use of
reflectat runtime for maximum performance. - Typed Schema: Uses
github.com/tinywasm/fmtfor deterministic field mapping. - Boilerplate Generator:
ormcCLI tool automates theModelinterface implementation and handles dependencies.