SkillAgentSearch skills...

Nexom

A strictly-ordered SQL query builder for Go that enforces proper query precedence through type-safe method chaining. Supports any `database/sql` driver (MySQL, PostgreSQL, SQLite).

Install / Use

/learn @devasherr/Nexom
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

Simple Go ORM

This is a lightweight, chainable ORM (Object-Relational Mapping) implementation in Go, built to provide a fluent and expressive interface for SQL operations without relying on heavy third-party ORM libraries.

Features

  • Fluent interface for building queries
  • Type-safe method chaining
  • Supports SELECT, INSERT, UPDATE, DELETE operations
  • Automatic parameter escaping

Installation

go get github.com/devasherr/nexom

Usage

Initialization

package main

import (
    "github.com/devasherr/nexom"
    _ "github.com/go-sql-driver/mysql"
)

func main() {
    // Initialize the driver
    norm := nexom.New("mysql", "username:password@/dbname")
    defer norm.db.Close()

    // Create an ORM instance for a table
    users := norm.NewOrm("users")
}

SELECT Queries

// Simple select
result, err := users.Select("id", "name", "email").Exec()

// Select with WHERE
result, err := users.Select().Where("id = ?", "1").Exec()

// Select with multiple conditions
result, err := users.Select("name", "email").Where("status = ? AND age > ? OR created_at > ?", "active", "25", "2025-01-01").Exec()

INSERT Queries

// Insert with columns and values
result, err := users.Insert("name", "email", "age").Values(
    nexom.V{
        {"John Doe", "john@example.com", "30"},
        {"Alice Johnson", "alice@example.com", "28"},
        {"Bob Williams", "bob@example.com", "35"}
    }).Exec()

UPDATE Queries

// Update with SET and WHERE
result, err := users.Update().
    Set(nexom.M{
        "name": "Jane Doe",
        "email": "jane@example.com",
    }).
    Where("id = ?", "1").
    Exec()

// Update with multiple conditions
result, err := users.Update().
    Set(nexom.M{
        "status": "inactive",
    }).
    Where("last_login = ? AND active = ? OR banned = ?", "< 2023-01-01", "false", "true").Exec()

DELETE Queries

// Simple delete
result, err := users.Delete().Where("id = ?", "1").Exec()

// Delete with multiple conditions
result, err := users.Delete().Where("status = ? AND last_login < ?", "inactive", "2022-01-01").Exec()

DROP TABLE

// Drop table
result, err := users.Drop().Exec()

Context

All operations support context for cancellation and timeouts:

ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second)
defer cancel()

// SELECT with context
result, err := users.Select().Where("id = ?", "1").ExecContext(ctx)

// INSERT with context
result, err := users.Insert("name", "email").Values(nexom.V{{"John", "john@example.com"}}).ExecContext(ctx)

// UPDATE with context
result, err := users.Update().Set(nexom.M{"name": "John"}).Where("id = ?", "1").ExecContext(ctx)

// DELETE with context
result, err := users.Delete().Where("id = ?", "1").ExecContext(ctx)

// DROP with context
result, err := users.Drop().ExecContext(ctx)

CONTRIBUTIONS

Pull requests and issues are welcome! If you'd like to contribute, feel free to fork and improve.

Related Skills

View on GitHub
GitHub Stars58
CategoryData
Updated1mo ago
Forks2

Languages

Go

Security Score

80/100

Audited on Feb 3, 2026

No findings