Skip to content

Commit

Permalink
feat: 1. add internal/json and replace encoding/json
Browse files Browse the repository at this point in the history
2. define gin.Middleware
3. implement gin.Middleware for replacing gin/process.go
  • Loading branch information
dapeng committed Jun 26, 2024
1 parent 4af08eb commit c5ebd37
Show file tree
Hide file tree
Showing 21 changed files with 579 additions and 417 deletions.
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,16 @@ go 1.21
toolchain go1.21.1

require (
github.com/bytedance/sonic v1.10.2
github.com/fsnotify/fsnotify v1.7.0
github.com/gin-gonic/gin v1.9.1
github.com/goccy/go-json v0.10.2
github.com/golang/mock v1.6.0
github.com/gomodule/redigo v1.8.9
github.com/google/uuid v1.6.0
github.com/imroc/req/v3 v3.43.3
github.com/jmoiron/sqlx v1.3.5
github.com/json-iterator/go v1.1.12
github.com/jtolds/gls v4.20.0+incompatible
github.com/magiconair/properties v1.8.7
github.com/mitchellh/mapstructure v1.5.0
Expand All @@ -33,7 +36,6 @@ require (

require (
github.com/andybalholm/brotli v1.1.0 // indirect
github.com/bytedance/sonic v1.10.2 // indirect
github.com/chenzhuoyu/base64x v0.0.0-20230717121745-296ad89f973d // indirect
github.com/chenzhuoyu/iasm v0.9.1 // indirect
github.com/cloudflare/circl v1.3.8 // indirect
Expand All @@ -45,14 +47,12 @@ require (
github.com/go-playground/universal-translator v0.18.1 // indirect
github.com/go-playground/validator/v10 v10.17.0 // indirect
github.com/go-task/slim-sprig/v3 v3.0.0 // indirect
github.com/goccy/go-json v0.10.2 // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/google/pprof v0.0.0-20240424215950-a892ee059fd6 // indirect
github.com/gopherjs/gopherjs v1.17.2 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/compress v1.17.8 // indirect
github.com/klauspost/cpuid/v2 v2.2.6 // indirect
github.com/leodido/go-urn v1.3.0 // indirect
Expand Down
2 changes: 1 addition & 1 deletion goner/gin/http-injector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ package gin

import (
"bytes"
"encoding/json"
"fmt"
"github.com/gin-gonic/gin"
"github.com/golang/mock/gomock"
"github.com/gone-io/gone"
"github.com/gone-io/gone/internal/json"
"github.com/stretchr/testify/assert"
"gopkg.in/yaml.v3"
"io"
Expand Down
4 changes: 4 additions & 0 deletions goner/gin/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,3 +130,7 @@ type HttInjector interface {
StartBindFuncs()
BindFuncs() BindStructFunc
}

type Middleware interface {
Process(ctx *gin.Context)
}
2 changes: 1 addition & 1 deletion goner/gin/priest.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ func Priest(cemetery gone.Cemetery) error {
cemetery.
BuryOnce(NewGinProxy()).
BuryOnce(NewGinRouter()).
BuryOnce(NewGinProcessor()).
BuryOnce(NewSysMiddleware()).
BuryOnce(NewGinResponser()).
BuryOnce(NewGinServer()).
BuryOnce(NewHttInjector())
Expand Down
167 changes: 0 additions & 167 deletions goner/gin/processor.go

This file was deleted.

Loading

0 comments on commit c5ebd37

Please sign in to comment.