[chore] Update all but bun libraries (#526)

* update all but bun libraries

Signed-off-by: kim <grufwub@gmail.com>

* remove my personal build script changes

Signed-off-by: kim <grufwub@gmail.com>
This commit is contained in:
kim
2022-05-02 14:05:18 +01:00
committed by GitHub
parent e06bf9cc9a
commit b56dae8120
350 changed files with 305366 additions and 5943 deletions

View File

@ -1,3 +1,5 @@
coverage.out
vendor/*
!/vendor/vendor.json
/gorm/test.db
.idea

View File

@ -0,0 +1,57 @@
project_name: queue
builds:
-
# If true, skip the build.
# Useful for library projects.
# Default is false
skip: true
changelog:
# Set it to true if you wish to skip the changelog generation.
# This may result in an empty release notes on GitHub/GitLab/Gitea.
skip: false
# Changelog generation implementation to use.
#
# Valid options are:
# - `git`: uses `git log`;
# - `github`: uses the compare GitHub API, appending the author login to the changelog.
# - `gitlab`: uses the compare GitLab API, appending the author name and email to the changelog.
# - `github-native`: uses the GitHub release notes generation API, disables the groups feature.
#
# Defaults to `git`.
use: git
# Sorts the changelog by the commit's messages.
# Could either be asc, desc or empty
# Default is empty
sort: asc
# Group commits messages by given regex and title.
# Order value defines the order of the groups.
# Proving no regex means all commits will be grouped under the default group.
# Groups are disabled when using github-native, as it already groups things by itself.
#
# Default is no groups.
groups:
- title: Features
regexp: "^.*feat[(\\w)]*:+.*$"
order: 0
- title: 'Bug fixes'
regexp: "^.*fix[(\\w)]*:+.*$"
order: 1
- title: 'Enhancements'
regexp: "^.*chore[(\\w)]*:+.*$"
order: 2
- title: Others
order: 999
filters:
# Commit messages matching the regexp listed here will be removed from
# the changelog
# Default is empty
exclude:
- '^docs'
- 'CICD'
- typo

View File

@ -13,6 +13,7 @@ Gin middleware for session management with multi-backend support:
- [Redis](#redis)
- [memcached](#memcached)
- [MongoDB](#mongodb)
- [GoRM](#gorm)
- [memstore](#memstore)
- [PostgreSQL](#postgresql)
@ -249,12 +250,13 @@ func main() {
### MongoDB
#### mgo
```go
package main
import (
"github.com/gin-contrib/sessions"
"github.com/gin-contrib/sessions/mongo"
"github.com/gin-contrib/sessions/mongo/mongomgo"
"github.com/gin-gonic/gin"
"github.com/globalsign/mgo"
)
@ -267,7 +269,54 @@ func main() {
}
c := session.DB("").C("sessions")
store := mongo.NewStore(c, 3600, true, []byte("secret"))
store := mongomgo.NewStore(c, 3600, true, []byte("secret"))
r.Use(sessions.Sessions("mysession", store))
r.GET("/incr", func(c *gin.Context) {
session := sessions.Default(c)
var count int
v := session.Get("count")
if v == nil {
count = 0
} else {
count = v.(int)
count++
}
session.Set("count", count)
session.Save()
c.JSON(200, gin.H{"count": count})
})
r.Run(":8000")
}
```
#### mongo-driver
```
package main
import (
"context"
"github.com/gin-contrib/sessions"
"github.com/gin-contrib/sessions/mongo/mongodriver"
"github.com/gin-gonic/gin"
"go.mongodb.org/mongo-driver/mongo"
"go.mongodb.org/mongo-driver/mongo/options"
)
func main() {
r := gin.Default()
mongoOptions := options.Client().ApplyURI("mongodb://localhost:27017")
client, err := mongo.NewClient(mongoOptions)
if err != nil {
// handle err
}
if err := client.Connect(context.Background()); err != nil {
// handle err
}
c := client.Database("test").Collection("sessions")
store := mongodriver.NewStore(c, 3600, true, []byte("secret"))
r.Use(sessions.Sessions("mysession", store))
r.GET("/incr", func(c *gin.Context) {
@ -322,46 +371,88 @@ func main() {
}
```
### GoRM
[embedmd]:# (_example/gorm/main.go go)
```go
package main
import (
"github.com/gin-contrib/sessions"
gormsessions "github.com/gin-contrib/sessions/gorm"
"github.com/gin-gonic/gin"
"gorm.io/driver/sqlite"
"gorm.io/gorm"
)
func main() {
db, err := gorm.Open(sqlite.Open("test.db"), &gorm.Config{})
if err != nil {
panic(err)
}
store := gormsessions.NewStore(db, true, []byte("secret"))
r := gin.Default()
r.Use(sessions.Sessions("mysession", store))
r.GET("/incr", func(c *gin.Context) {
session := sessions.Default(c)
var count int
v := session.Get("count")
if v == nil {
count = 0
} else {
count = v.(int)
count++
}
session.Set("count", count)
session.Save()
c.JSON(200, gin.H{"count": count})
})
r.Run(":8000")
}
```
### PostgreSQL
```go
package main
import (
"database/sql"
"github.com/gin-contrib/sessions"
"github.com/gin-contrib/sessions/postgres"
"github.com/gin-gonic/gin"
"database/sql"
"github.com/gin-contrib/sessions"
"github.com/gin-contrib/sessions/postgres"
"github.com/gin-gonic/gin"
)
func main() {
r := gin.Default()
db, err := sql.Open("postgres", "postgresql://username:password@localhost:5432/database")
if err != nil {
// handle err
}
r := gin.Default()
db, err := sql.Open("postgres", "postgresql://username:password@localhost:5432/database")
if err != nil {
// handle err
}
store, err := postgres.NewStore(db, []byte("secret"))
if err != nil {
// handle err
}
store, err := postgres.NewStore(db, []byte("secret"))
if err != nil {
// handle err
}
r.Use(sessions.Sessions("mysession", store))
r.Use(sessions.Sessions("mysession", store))
r.GET("/incr", func(c *gin.Context) {
session := sessions.Default(c)
var count int
v := session.Get("count")
if v == nil {
count = 0
} else {
count = v.(int)
count++
}
session.Set("count", count)
session.Save()
c.JSON(200, gin.H{"count": count})
})
r.Run(":8000")
r.GET("/incr", func(c *gin.Context) {
session := sessions.Default(c)
var count int
v := session.Get("count")
if v == nil {
count = 0
} else {
count = v.(int)
count++
}
session.Set("count", count)
session.Save()
c.JSON(200, gin.H{"count": count})
})
r.Run(":8000")
}
```

View File

@ -111,6 +111,7 @@ func (s *session) Flashes(vars ...string) []interface{} {
}
func (s *session) Options(options Options) {
s.written = true
s.Session().Options = options.ToGorillaOptions()
}