Categorygithub.com/patrickkabwe/goorm
modulepackage
0.0.0-20241110123614-60c4d0cb2ec8
Repository: https://github.com/patrickkabwe/goorm.git
Documentation: pkg.go.dev

# README

šŸš€ goorm

Goorm is a QueryBuilder\ORM for Go that supports PostgreSQL, MySQL, and SQLite. Built with simplicity and flexibility in mind.

šŸ“¦ Installation

go get github.com/patrickkabwe/goorm

[!NOTE] šŸ”„ The Goorm ORM is yet to be implemented

āš ļø Disclaimer

[!WARNING] This module is still under development. Use at your own risk. The API is experimental and subject to change. This module tries to create a simple and intuitive API for interacting with databases. However, it is not a replacement for a professional database management system (DBMS) like PostgreSQL, MySQL, or SQLite.

šŸŽÆ Usage

package main

import (
	"fmt"
	"os"
	"github.com/patrickkabwe/goorm"
)

type User struct {
	ID      int64    `db:"id"`
	Name    string   `db:"name"`
	Email   string   `db:"email"`
}

func main() {
	db, err := sql.Open(
		string(goorm.Postgres),
		os.Getenv("POSTGRES_DSN"),
	)

	if err != nil {
		log.Fatalln(err)
	}

	defer db.Close()

	qb = orm.NewQueryBuilder(db, &orm.PostgreSQL{}, nil)
	ctx := context.Background()
	email := "[email protected]"
	user := &User{}
	err := qb.
		InsertInto("users").
		Columns("name", "email").
		Values("patrick", email).
		Returning(ctx, user, "id", "email")

	fmt.Println(user)
}

✨ Features

  • šŸ› ļø Flexible Query Building
    • SELECT with DISTINCT support
    • INSERT, UPDATE, DELETE operations
    • Complex JOIN operations
    • WHERE clauses with AND, OR, NOT
    • GROUP BY, HAVING, ORDER BY
    • LIMIT and OFFSET pagination
  • šŸ”’ Type Safety
    • Strongly typed parameters
    • Struct mapping for results
  • šŸ“Š Database Support
    • PostgreSQL
    • MySQL
    • SQLite (coming soon)
  • šŸ”„ Advanced Features
    • Transaction support
    • RETURNING clause
    • Custom logger integration
    • Nested struct mapping
    • Auto table name prefixing

šŸ“„ License

MIT License

Copyright (c) 2024 Patrick Kabwe

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

šŸ¤ Contributing

Contributions are welcome! Feel free to:

  • Open issues for bugs or feature requests
  • Submit pull requests
  • Improve documentation
  • Share feedback

Made with ā¤ļø by Patrick Kabwe

ā­ļø If you find this project helpful, please give it a star!

# Packages

No description provided by the author

# Functions

No description provided by the author
No description provided by the author
No description provided by the author

# Constants

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Structs

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
MYSQL dialect.
PostgreSQL dialect implementation.
No description provided by the author
SQLite dialect implementation.
No description provided by the author

# Interfaces

Dialect defines the interface that each database dialect must implement.
No description provided by the author

# Type aliases

Driver represents the database driver.