All Projects → pvrzl → growl

pvrzl / growl

Licence: MIT license
gorm, redis and local cache layer

Programming Languages

go
31211 projects - #10 most used programming language
Makefile
30231 projects

Projects that are alternatives of or similar to growl

public
util toolkit for go.golang 通用函数包
Stars: ✭ 135 (+610.53%)
Mutual labels:  cache, gorm
Gcache
gcache是gorm的中间件,插入后gorm即刻拥有缓存。
Stars: ✭ 271 (+1326.32%)
Mutual labels:  cache, gorm
go-echo-server-sandbox
A scaffold of golang web server using labstack/echo
Stars: ✭ 12 (-36.84%)
Mutual labels:  gorm
nginx-cache
Node.js module to find files in an Nginx cache based on partial URL keys
Stars: ✭ 24 (+26.32%)
Mutual labels:  cache
storage-box
Intuitive and easy-to-use storage box.
Stars: ✭ 26 (+36.84%)
Mutual labels:  cache
go-ddd-api
API with domain driven design approach using golang, gorm, and mysql
Stars: ✭ 136 (+615.79%)
Mutual labels:  gorm
echo-mw
统一移到hb-go/echo-web ☞
Stars: ✭ 17 (-10.53%)
Mutual labels:  cache
clean-gin
Implementation of clean architecture in Go, Gin with dependency injection.
Stars: ✭ 181 (+852.63%)
Mutual labels:  gorm
netlify-plugin-cache
⚡ Generic plugin for caching any files and/or folders between Netlify builds
Stars: ✭ 19 (+0%)
Mutual labels:  cache
onecache
One caching API, Multiple backends
Stars: ✭ 126 (+563.16%)
Mutual labels:  cache
node-cache-manager-ioredis
Redis store for node-cache-manager using IORedis.
Stars: ✭ 47 (+147.37%)
Mutual labels:  cache
souin
An HTTP cache system, RFC compliant, compatible with @TykTechnologies, @traefik, @caddyserver, @go-chi, @bnkamalesh, @beego, @devfeel, @labstack, @gofiber, @go-goyave, @gin-gonic, @zalando, @zeromicro, @nginx and @apache
Stars: ✭ 269 (+1315.79%)
Mutual labels:  cache
sqlserver
GORM sqlserver driver
Stars: ✭ 33 (+73.68%)
Mutual labels:  gorm
composer-velocita
Velocita - Composer plugin for transparent caching
Stars: ✭ 26 (+36.84%)
Mutual labels:  cache
grails-audit-logging-plugin
The Grails Audit Logging Plugin
Stars: ✭ 49 (+157.89%)
Mutual labels:  gorm
WP-Stash
Bridge between WordPress and StashPHP, providing a PSR6-compliant caching system for WordPress
Stars: ✭ 31 (+63.16%)
Mutual labels:  cache
nested-set
Nested Set is an Go implementation of the Nested set model for Gorm.
Stars: ✭ 44 (+131.58%)
Mutual labels:  gorm
gin-gorm-api-example
[Article] Minimal code for Golang based API
Stars: ✭ 98 (+415.79%)
Mutual labels:  gorm
iam
企业级的 Go 语言实战项目:认证和授权系统
Stars: ✭ 1,900 (+9900%)
Mutual labels:  gorm
go-memoize
An easy, no-frills memoizer for Go. Cache your expensive function calls.
Stars: ✭ 63 (+231.58%)
Mutual labels:  cache

Growl

Build Status codecov

this package is deprecated

Overview

Growl is another layer for https://github.com/jinzhu/gorm, https://github.com/go-redis/redis and https://github.com/patrickmn/go-cache

  • Simple config file for db, redis
  • ORM like
  • Auto set/get cache on query
Installation
go get github.com/homina/growl
Import package in your project
import (
    "github.com/homina/growl"
)

Config file

growl:
  database:
    driver: mysql
    url: root:@/
    name: "growl_test?charset=utf8&parseTime=True&loc=Local&sql_mode='ALLOW_INVALID_DATES'"
    prefix:  
    singulartable: false # default : false
  redis:
    host: localhost
    port: "6379"
    password:
    channel: "channel"
    enable: true
  misc:
    localcache: true # enable go-cache
    log: true # enable gorm log
    flushatinit: true # flush cache at start

Example

package main

import (
  "fmt"

  "github.com/homina/growl"
  _ "github.com/jinzhu/gorm/dialects/mysql"
)

type TestTable struct {
  Name string `valid:"required" gorm:"unique_index"`
  Id   int    `gorm:"AUTO_INCREMENT"`
}

func (test *TestTable) Db() (db growl.Db) {
  return db.SetData(test)
}

func migrateTestTable() {
  conn, _ := growl.Conn()
  conn.AutoMigrate(TestTable{})
}

func deleteTestTable() {
  conn, _ := growl.Conn()
  conn.DropTable(TestTable{})
}

func main() {
  growl.Config.Path = "conf.yaml"
  err := growl.Config.Load()
  if err != nil {
    fmt.Println(err)
    return
  }

  migrateTestTable()

  test := new(TestTable)
  test.Name = "test01"
  err = test.Db().Save().Error()
  if err != nil {
    fmt.Println(err)
    return
  }

  fmt.Printf("%+v", test)
  // &{Name:test01 Id:1}

  test.Name = "test02"
  err = test.Db().Model(test).Where("id = ?",test.Id).Update().Error()
  if err != nil {
    fmt.Println(err)
    return
  }

  err = test.Db().First().Error()
  if err != nil {
    fmt.Println(err)
    return
  }
  fmt.Printf("%+v", test)
  // &{Name:test02 Id:1}

  err = test.Db().Where("id = ?",test.Id).Delete().Error()
  if err != nil {
    fmt.Println(err)
    return
  }

  deleteTestTable()
}

Validation

Reference : https://github.com/asaskevich/govalidator

todo

  • debug mode
  • optimize raw

Test

  • docker run -d -p 6379:6379 --name=redis redis:latest
  • docker run -d -p 3306:3306 --name=mysql -e MYSQL_ALLOW_EMPTY_PASSWORD=yes mysql:5.7
  • make test
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].