norm

module
v0.2.13 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2023 License: Apache-2.0

README

norm (NoORM)

Build Status Go Report Card go.dev reference Apache 2 licensed

This repository provides a no frills, no bloat and no magic collection of utilities for working with SQL code and databases in Go. It relies solely on standard library packages and focuses on simplicity, stability and performance.

Packages

norm/statement

A simple and performant SQL query builder for Go which doesn't hide or obscures SQL code and logic but rather makes them explicit and a fundamental part of the application code.

It handles the all parameter interpolation at the package level using the ? placeholder, so queries are mostly portable across databases.

Features
* Select
	* Comment
	* Columns
	* From (table or statement.SelectStatement)
	* Join
	* Where
	* WhereIn
	* With (statement.SelectStatement)
	* WithRecursive (statement.SelectStatement)
	* Having
	* GroupBy
	* Order
	* Limit
	* Offset
	* Distinct
	* ForUpdate
	* SkipLocked
	* Union (statement.SelectStatement)
	* UnionAll (statement.SelectStatement)
* Insert
	* Comment
	* Into
	* With (statement.SelectStatement)
	* Returning
	* Record (from struct)
	* ValuesSelect (statement.SelectStatement)
	* OnConflict
* Update
	* Comment
	* Table
	* Set
	* SetMap
	* With (statement.SelectStatement)
	* Where
	* WhereIn
	* Returning
* Delete
	* Comment
	* From
	* With (statement.SelectStatement)
	* Where
	* WhereIn
	* Returning
* DDL
	* Comment
	* Create
	* Alter
	* Truncate
	* Drop

norm/database

A safe sql.DB wrapper which enforces transactional access to the database, transaction query caching and operation logging and plays nicely with norm/statement.

Features
* Contextual operation logging
* Transactional access with default isolation level
* Cursor for traversing large result sets
* Row scanning into structs or []struct
* Transaction scoped query caching
* Transaction ids for request tracing

norm/migrate

A simple database migration package which does the necessary, not less, not more.

Features
* Migration sequence management
* Migrate Up/Down/Apply(<version>)
* Apply/discard migrations
* Transactional apply/discard migrations

Motivation

I like simple, efficient and clean code. There is too much ORM stuff floating around these days.

Install
go get -u -v github.com/brunotm/norm

Test

go test -v -cover ./...

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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