Skip to content

Commit 2c62cc5

Browse files
Merge pull request #61 from tianxiaoliang/main
add new runtime interface
2 parents b54632a + f7c980e commit 2c62cc5

File tree

11 files changed

+23
-17
lines changed

11 files changed

+23
-17
lines changed

.github/workflows/db-ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
- name: Set up Go
88
uses: actions/setup-go@v1
99
with:
10-
go-version: 1.16
10+
go-version: 1.18
1111
id: go
1212
- name: Check out source code
1313
uses: actions/checkout@v1
@@ -27,7 +27,7 @@ jobs:
2727
- name: Set up Go
2828
uses: actions/setup-go@v1
2929
with:
30-
go-version: 1.16
30+
go-version: 1.18
3131
id: go
3232
- name: Check out source code
3333
uses: actions/checkout@v1

.github/workflows/golangci-lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@ jobs:
1515
- name: golangci-lint
1616
uses: golangci/golangci-lint-action@v2
1717
with:
18-
version: v1.45.2
18+
version: v1.48.0
1919
args: --skip-dirs=discovery --skip-files=.*_test.go$

.github/workflows/static_check.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ jobs:
44
build:
55
runs-on: ubuntu-latest
66
steps:
7-
- name: Set up Go 1.16
7+
- name: Set up Go 1.18
88
uses: actions/setup-go@v1
99
with:
10-
go-version: 1.16
10+
go-version: 1.18
1111
id: go
1212
- name: Check out code into the Go module directory
1313
uses: actions/checkout@v1

codec/codec.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package codec
2+
3+
// Codec declares encode and decode functions
4+
type Codec interface {
5+
Encode(v any) ([]byte, error)
6+
Decode(data []byte, v any) error
7+
}

config/config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
package config
1919

20-
//KVDoc is database struct to store kv
20+
// KVDoc is database struct to store kv
2121
type KVDoc struct {
2222
ID string `json:"id,omitempty" bson:"id,omitempty" yaml:"id,omitempty" swag:"string"`
2323
LabelFormat string `json:"label_format,omitempty" bson:"label_format,omitempty" yaml:"label_format,omitempty"`

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/go-chassis/cari
22

3-
go 1.17
3+
go 1.18
44

55
require (
66
github.com/deckarep/golang-set v1.7.1

go.sum

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA
5151
github.com/certifi/gocertifi v0.0.0-20191021191039-0944d244cd40/go.mod h1:sGbDF6GwGcLpkNXPUTkMRoywsNa/ol15pxFe6ERfguA=
5252
github.com/certifi/gocertifi v0.0.0-20200922220541-2c3bb06c6054 h1:uH66TXeswKn5PW5zdZ39xEwfS9an067BirqA+P4QaLI=
5353
github.com/certifi/gocertifi v0.0.0-20200922220541-2c3bb06c6054/go.mod h1:sGbDF6GwGcLpkNXPUTkMRoywsNa/ol15pxFe6ERfguA=
54-
github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko=
5554
github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc=
5655
github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY=
5756
github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=

rbac/cache.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ type PersistPerms func(r *Role) error
1818

1919
var permsCache = ccache.New(ccache.Configure())
2020

21-
//WritePerms save cache
21+
// WritePerms save cache
2222
func WritePerms(r *Role) error {
2323
permsCache.Set(r.Name, r, DefaultTTL)
2424
return nil
2525
}
2626

27-
//ReadPerms only return data in cache
27+
// ReadPerms only return data in cache
2828
func ReadPerms(roleName string) ([]*Permission, error) {
2929
item := permsCache.Get(roleName)
3030
if item == nil || item.Value() == nil {

rbac/rbac.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ func GetRolesList(m map[string]interface{}) ([]string, error) {
114114
return roleList, nil
115115
}
116116

117-
//BuildResourceList join the resource to an array
117+
// BuildResourceList join the resource to an array
118118
func BuildResourceList(resourceType ...string) []*Resource {
119119
rt := make([]*Resource, len(resourceType))
120120
for i := 0; i < len(resourceType); i++ {

rbac/resource_map.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ import (
2222
"sync"
2323
)
2424

25-
//as a user of a backend service, he only understands resource of this service,
26-
//to decouple authorization code from business code,
27-
//a middleware should handle all the authorization logic, and this middleware only understand rest API,
28-
//a resource mapping helps to maintain relations between api and resource.
25+
// as a user of a backend service, he only understands resource of this service,
26+
// to decouple authorization code from business code,
27+
// a middleware should handle all the authorization logic, and this middleware only understand rest API,
28+
// a resource mapping helps to maintain relations between api and resource.
2929
var resourceMap = sync.Map{}
3030

31-
//PartialMap saves api partial matching
31+
// PartialMap saves api partial matching
3232
var PartialMap = map[string]string{}
3333

3434
// GetResource try to find resource by API path, it has preheat mechanism after program start up

0 commit comments

Comments
 (0)