Skip to content

Repository files navigation

SQL GORM for Tinh Tinh

GitHub ReleaseGitHub LicenseGo Reference
Tinh Tinh Logo

Overview

SQL GORM for Tinh Tinh is a powerful database toolkit designed to work seamlessly with the Tinh Tinh framework. It provides an elegant and efficient way to interact with SQL databases using GORM, the fantastic ORM library for Golang.

Features

  • 🚀 Full GORM integration with Tinh Tinh
  • 📦 Easy-to-use database operations
  • 🔄 Auto Migration support
  • 🎯 Type-safe query building
  • 🛠️ Advanced features like:
    • Associations handling
    • Hooks
    • Transactions
    • Custom data types
    • And more!

Installation

To install the package, use:

go get -u github.com/tinh-tinh/sqlorm/v2

Quick Start

package main
import (
"github.com/tinh-tinh/sqlorm/v2"
)
// User represents your database modeltypeUserstruct {
IDuint`gorm:"primarykey"`NamestringEmailstring
}
funcmain() {
// Initialize your database connectiondb:=sqlorm.New(&sqlorm.Config{
Driver: "postgres",
Host: "localhost",
Port: 5432,
Database: "mydb",
Username: "user",
Password: "password",
})
// Auto migrate your modelsdb.AutoMigrate(&User{})
// Create a new useruser:=User{
Name: "John Doe",
Email: "john@example.com",
}
db.Create(&user)
}

Configuration

The package supports various database configurations:

typeConfigstruct {
Driverstring// "postgres", "mysql", "sqlite"HoststringPortintDatabasestringUsernamestringPasswordstringSSLModestringTimeZonestring
}

Supported Databases

  • PostgreSQL
  • MySQL
  • SQLite
  • Microsoft SQL Server

Documentation

For detailed documentation and examples, please visit:

Contributing

We welcome contributions! Here's how you can help:

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Support

If you encounter any issues or need help, you can:

  • Open an issue in the GitHub repository
  • Check our documentation
  • Join our community discussions

About

⛓ SQL Gorm Module for Tinh Tinh Framework

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages