All Projects → go-gorm → mysql

go-gorm / mysql

Licence: MIT license
GORM mysql driver

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to mysql

Grails Data Mapping
GORM - Groovy Object Mapping
Stars: ✭ 194 (+53.97%)
Mutual labels:  gorm
go-pangu
rest api web server based on go(High availability, high security, high performance)
Stars: ✭ 45 (-64.29%)
Mutual labels:  gorm
simple-wallet
This is a simple wallet REST api that is capable of acount deposits and withdrawals, checking for account balance and providing a ministatement. It follows domain driven design practices. The project uses the DDD architecture approach.
Stars: ✭ 32 (-74.6%)
Mutual labels:  gorm
Golang Project Structure
Golang Skeleton with fully version managed
Stars: ✭ 103 (-18.25%)
Mutual labels:  gorm
BEW-2.5-Strongly-Typed-Languages
💪 Learn and implement the design patterns and best practices that make Go a top choice at high-velocity startups like Lyft, Heroku, Docker, Medium, and more!
Stars: ✭ 14 (-88.89%)
Mutual labels:  gorm
simple-mpesa
A simple example of how MPESA works. Works with all 3 types of customers i.e. Agents, Merchants and Subscribers. Allows you to configure a tariff and apply it to transactions. The project follows DDD principles.
Stars: ✭ 31 (-75.4%)
Mutual labels:  gorm
Go init
一个用go组织项目结构,主要包括 gin, goredis, gorm, websocket, rabbitmq等。👉
Stars: ✭ 183 (+45.24%)
Mutual labels:  gorm
go api boilerplate
🐶Go (Golang)🚀REST / GraphQL API + Postgres boilerplate
Stars: ✭ 127 (+0.79%)
Mutual labels:  gorm
opentracing-gorm
OpenTracing instrumentation for GORM.
Stars: ✭ 46 (-63.49%)
Mutual labels:  gorm
gorm-paginator
gorm pagination extension
Stars: ✭ 154 (+22.22%)
Mutual labels:  gorm
Gorm Bulk Insert
implement BulkInsert using gorm, just pass a Slice of Struct. Simple and compatible.
Stars: ✭ 241 (+91.27%)
Mutual labels:  gorm
golang-example-app
Example application
Stars: ✭ 138 (+9.52%)
Mutual labels:  gorm
go-orm-code-helper
🔥🔥🔥go-orm-code-helper is a goland plugin, it aims to make gorm code getting more simple
Stars: ✭ 22 (-82.54%)
Mutual labels:  gorm
Fuckdb
From database generate go struct,help you fuck db fields
Stars: ✭ 195 (+54.76%)
Mutual labels:  gorm
prometheus
Collect DB Status or user-defined metrics with Prometheus
Stars: ✭ 94 (-25.4%)
Mutual labels:  gorm
Go Mocket
Go GORM & SQL mocking library
Stars: ✭ 190 (+50.79%)
Mutual labels:  gorm
gorm-mongodb
GORM for MongoDB
Stars: ✭ 58 (-53.97%)
Mutual labels:  gorm
ginadmin
基于Gin开发的后台管理系统,集成了、数据库操作、日志管理、权限分配管理、多模板页面、自动分页器、数据库迁移和填充、Docker集成部署等功能、静态资源打包
Stars: ✭ 149 (+18.25%)
Mutual labels:  gorm
go-graphql-api-boilerplate
A Boilerplate of GraphQL API built in Go + graphql-go + gorm
Stars: ✭ 75 (-40.48%)
Mutual labels:  gorm
grom
A powerful command line tool for converting mysql table fields to golang model structure.
Stars: ✭ 44 (-65.08%)
Mutual labels:  gorm

GORM MySQL Driver

Quick Start

import (
  "gorm.io/driver/mysql"
  "gorm.io/gorm"
)

// https://github.com/go-sql-driver/mysql
dsn := "gorm:gorm@tcp(localhost:9910)/gorm?charset=utf8&parseTime=True&loc=Local"
db, err := gorm.Open(mysql.Open(dsn), &gorm.Config{})

Configuration

import (
  "gorm.io/driver/mysql"
  "gorm.io/gorm"
)

var datetimePrecision = 2

db, err := gorm.Open(mysql.New(mysql.Config{
  DSN: "gorm:gorm@tcp(localhost:9910)/gorm?charset=utf8&parseTime=True&loc=Local", // data source name, refer https://github.com/go-sql-driver/mysql#dsn-data-source-name
  DefaultStringSize: 256, // add default size for string fields, by default, will use db type `longtext` for fields without size, not a primary key, no index defined and don't have default values
  DisableDatetimePrecision: true, // disable datetime precision support, which not supported before MySQL 5.6
  DefaultDatetimePrecision: &datetimePrecision, // default datetime precision
  DontSupportRenameIndex: true, // drop & create index when rename index, rename index not supported before MySQL 5.7, MariaDB
  DontSupportRenameColumn: true, // use change when rename column, rename rename not supported before MySQL 8, MariaDB
  SkipInitializeWithVersion: false, // smart configure based on used version
}), &gorm.Config{})

Customized Driver

import (
  _ "example.com/my_mysql_driver"
  "gorm.io/gorm"
)

db, err := gorm.Open(mysql.New(mysql.Config{
  DriverName: "my_mysql_driver_name",
  DSN: "gorm:gorm@tcp(localhost:9910)/gorm?charset=utf8&parseTime=True&loc=Local", // data source name, refer https://github.com/go-sql-driver/mysql#dsn-data-source-name
})

Checkout https://gorm.io for details.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].