module
Version:
v1.0.9
Opens a new window with list of versions in this module.
Published: Oct 8, 2022
License: MIT
Opens a new window with license information.
README
¶
gowrap
Wrapper around gorm ORM to simplify queries, pagination
and struct validation.
Installation
go get github.com/abiiranathan/gowrap
Usage
package main
import (
"github.com/abiiranathan/gowrap/orm"
)
type Post struct {
ID uint `json:"id" gorm:"primaryKey"`
Title string `json:"title" gorm:"not null; unique" validate:"required,max=255"`
CreateAt time.Time `json:"created_at" validate:"omitempty"`
}
func main(){
db := orm.ConnectToSqlite3(orm.MemorySQLiteDB, true)
err := db.AutoMigrate(&Post{})
if err != nil {
t.Fatalf("unable to run gorm automigrate: %v", err)
}
dborm := orm.New(db)
p := &Post{Title: "My first post", CreateAt: db.NowFunc()}
err = dborm.Insert(p)
...
}
Directories
¶
implentation of a safe concurrent generic map
|
implentation of a safe concurrent generic map |
|
|
|
|
|
|
Simple wrapper around http.Server with graceful shutdown and easy tls setup.
|
Simple wrapper around http.Server with graceful shutdown and easy tls setup. |
|
|
websocket handler built on top of guerilla/websocket
|
websocket handler built on top of guerilla/websocket |
Click to show internal directories.
Click to hide internal directories.