Skip to content
This repository was archived by the owner on Oct 19, 2023. It is now read-only.

Latest commit

History

8 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

ORM - Gorm Wrapper for Kwiscale

Coverage StatusBuild Status

Gorm is a complete ORM for Go. Kwiscale/Gorm is a simple wrapper to be able to implement database in framework.

Usage

In your main package, simply import and initialize database connection.

package main
import (
"gopkg.in/kwiscale/framework.v1""gopkg.in/kwiscale/orm.v1"
_ "gopkg.in/kwiscale/orm.v1/dialects/sqlite"
)
// User is a simple orm.ModeltypeUserstruct {
orm.ModelNamestringAgeint
}
funcinit() {
orm.Initialize("sqlite", "./test.db")
db:=orm.Get()
deferdb.Close()
// Create table, update if neededdb.AutoMigrate(&User{})
}

Then, you may insert, delete, find, and so on.

user:=User{
Name: "Foo",
Age: 42,
}
db:=orm.Get()
deferdb.Close()
db.Create(&user)
// find a user and set it on// "res" structureres:=User{}
db.First(&res, &User{Name:"Foo"})

To get more information on requests, see Gorm documentation

About

Kwiscale ORM is a wrapper on excellent GORM https://github.com/jinzhu/gorm ORM

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages