Skip to content

Custom Konsultin SQL query builder with PostgreSQL support and schema utilities

License

Notifications You must be signed in to change notification settings

go-konsultin/sqlk

Repository files navigation

sqlk - SQL Query Builder

🗄️ Custom Konsultin SQL query builder with PostgreSQL support and schema utilities.

Installation

go get github.com/konsultin/sqlk

Quick Start

import (
    "github.com/konsultin/sqlk"
    "github.com/konsultin/sqlk/pq/query"
)

// Create database connection
db, err := sqlk.NewDatabase(sqlk.Config{
    Driver:   "postgres",
    Host:     "localhost",
    Port:     5432,
    User:     "postgres",
    Password: "password",
    Database: "mydb",
})
if err != nil {
    log.Fatal(err)
}
defer db.Close()

// Build SELECT query
q := query.Select("id", "name", "email").
    From("users").
    Where(query.Equal("status", "active")).
    Limit(10)

sql, args := q.Build()
// SELECT id, name, email FROM users WHERE status = $1 LIMIT 10

// Build INSERT query
q := query.Insert("users").
    Columns("name", "email").
    Values("John", "john@example.com")

Features

  • Query Builder - Fluent API for SELECT, INSERT, UPDATE, DELETE
  • PostgreSQL Support - Native dialect with bindvar support
  • Where Conditions - Equal, NotEqual, In, Like, IsNull, And, Or
  • Transaction Support - Easy transaction management
  • Connection Pooling - Configurable pool settings

License

MIT License - see LICENSE

About

Custom Konsultin SQL query builder with PostgreSQL support and schema utilities

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages