getting-started

command
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Example: getting-started

The "hello world" of drel — demonstrates the full codegen workflow using a simple Task model with exported fields:

  1. Define a model with drel.Model[K] and exported fields + db tags
  2. Run `drel generate` to produce scan/snapshot/diff/meta code
  3. Use the generated DB struct with typed repositories for CRUD

This example shows inserts via transaction, ordered queries using generated column refs, update with change tracking, filtered queries, and count operations.

Usage:

cd examples/getting-started
go run ../../cmd/drel generate   # generates models/task_drel.go + db/drel_gen.go
export DATABASE_URL="postgres://localhost:5432/drelexample?sslmode=disable"
go run .

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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