{"repo":"mylxsw/eloquent","free":true,"listed":false,"github":"https://github.com/mylxsw/eloquent","clone":"git clone https://github.com/mylxsw/eloquent.git","description":"Eloquent is a code-generation based database ORM framework for Go, inspired by the Eloquent ORM in the PHP framework Laravel. Supports MySQL and PostgreSQL.","language":"Go","stars":25,"topics":["orm","golang","eloquent","laravel","database","migrate"],"license":"MIT","category":"databases-storage","readme_excerpt":"Eloquent ORM for Go English 中文文档 Eloquent is a code-generation based database ORM framework for Go, inspired by the Eloquent ORM in the PHP framework Laravel. Supports MySQL and PostgreSQL. Table of Contents - Core Concepts - Quick Start - Installation - Model Definition & Code Generation - Database Dialect (MySQL / PostgreSQL) - Database Connection - CRUD Operations - Query Builder - Model Relationships - Soft Deletes - Scopes - Database Migrations - Transactions - Event System - Direct Database Operations - Example Projects Core Concepts Understanding these core concepts will help you get started with Eloquent quickly: 1. Code Generation Driven Eloquent does not use runtime reflection to map database tables. Instead, it works through a YAML model definition - CLI tool generates Go code workflow: - Write a YAML file describing your database table structure - Run the eloquent gen command to generate the corresponding Go code ( .orm.go files) - The generated code contains type-safe model structs and complete CRUD methods 2. Two Model Structs For each model (e.g., User ), Eloquent generates two structs: - UserN (Nullable version): All fields use null.Int , null.String , etc. (from gopkg.in/guregu/null.v3 ), correctly handling NULL values from the database. This is the primary struct used for database interaction. - User (Plain version): All fields use Go primitive types ( int64 , string , etc.). When a database field is NULL , it returns the zero value. Suitable for use in busi","default_branch":null,"files":null,"tree":[],"storefront":"/r/mylxsw","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/mylxsw/eloquent/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}