Skip to content
/ norm Public

A no frills, no bloat, no magic Go package for working with SQL code, databases and migrations.

License

Notifications You must be signed in to change notification settings

brunotm/norm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

76 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

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

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

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 ./...

About

A no frills, no bloat, no magic Go package for working with SQL code, databases and migrations.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages