go-query-builder

SQL Query Builder written in Go for sql module

GitHub issues GitHub stars GitHub license GitHub issues

Requirements

  • Go 1.17+

Tests

$go test

Examples

Simple select

package main

import (
    import "github.com/c0de4un/go-query-builder"
    // ...
)

func main() {
	builder := NewBuilder()
	builder.Select("users.*")
	builder.Select("projects.id")
    builder.From("users")
    builder.Join("projects", "projects.id = users.project_id", "LEFT")
    builder.Where("users.id", ">", 1)
    query := builder.Compile()

    // Execute query
}

GitHub

View Github