modulepackage
0.2.0
Repository: https://github.com/ydb-platform/gorm-driver.git
Documentation: pkg.go.dev
# README
GORM YDB Driver
YDB support for GORM
Quick Start
You can simply test your connection to your database with the following:
package main
import (
ydb "github.com/ydb-platform/gorm-driver"
"gorm.io/gorm"
)
type User struct {
Name string `gorm:"primarykey"`
Age int
}
func main() {
db, err := gorm.Open(ydb.Open("grpc://localhost:2136/local"))
if err != nil {
panic("failed to connect database")
}
// Auto Migrate
db.AutoMigrate(&User{})
// Insert
db.Create(&User{Name: "Angeliz", Age: 18})
// Select
db.Find(&User{}, "name = ?", "Angeliz")
// Batch Insert
user1 := User{Name: "Charles", Age: 12}
user2 := User{Name: "Feynman", Age: 13}
user3 := User{Name: "Michael", Age: 14}
users := []User{user1, user2, user3}
db.Create(&users)
// ...
}
# 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
No description provided by the author
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
No description provided by the author