-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
包括gormgen生成、casbinredis 等
- Loading branch information
Showing
193 changed files
with
23,058 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
ctlmodel: | ||
cd testgorm/testgen/gendemo2/ && go run generate.go |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package main | ||
|
||
import ( | ||
"github.com/prometheus/client_golang/prometheus" | ||
"github.com/prometheus/client_golang/prometheus/promhttp" | ||
"net/http" | ||
"time" | ||
) | ||
|
||
func main() { | ||
temp := prometheus.NewGauge(prometheus.GaugeOpts{ | ||
Name: "home_temperature_celsius", | ||
Help: "The current temperature in degrees Celsius.", | ||
}) | ||
prometheus.MustRegister(temp) | ||
temp.Set(39) | ||
go func() { | ||
for { | ||
temp.Add(4) | ||
time.Sleep(50000) | ||
} | ||
}() | ||
// Serve the default Prometheus metrics registry over HTTP on /metrics. | ||
http.Handle("/metrics", promhttp.Handler()) | ||
http.ListenAndServe(":8080", nil) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package main | ||
|
||
import ( | ||
"github.com/prometheus/client_golang/prometheus" | ||
"github.com/prometheus/client_golang/prometheus/promhttp" | ||
"net/http" | ||
) | ||
|
||
// 使用、暴露和创建一个非全局注册对象 | ||
func main() { | ||
registry := prometheus.NewRegistry() | ||
// 添加process和go运行时指标到自定义的注册表中 | ||
//registry.MustRegister(prometheus.NewProcessCollector( | ||
// prometheus.ProcessCollectorOpts{})) | ||
//registry.MustRegister(prometheus.NewGoCollector()) | ||
// 创建一个简单的gauge指标 | ||
temp := prometheus.NewGauge(prometheus.GaugeOpts{ | ||
Name: "home_temperature_celsius", | ||
Help: "The current temperature in degrees Celsius.", | ||
}) | ||
registry.MustRegister(temp) | ||
temp.Set(39) | ||
|
||
http.Handle("/metrics", promhttp.HandlerFor(registry, promhttp.HandlerOpts{ | ||
Registry: registry, | ||
})) | ||
http.ListenAndServe(":8080", nil) | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,15 @@ | ||
[role_definition] | ||
g = _,_ | ||
|
||
|
||
[matchers] | ||
m= g ( r.sub,p.sub) && r.obj == p.obj &&r.act ==p.act | ||
|
||
|
||
[request_definition] | ||
r = sub, obj, act | ||
|
||
[policy_definition] | ||
p = sub, obj, act,eft | ||
|
||
|
||
[role_definition] | ||
g = _,_ | ||
|
||
[policy_effect] | ||
e = some(where (p.eft == allow)) && !some(where (p.eft == deny)) | ||
e = some(where (p.eft == allow)) && !some(where (p.eft == deny)) | ||
|
||
[matchers] | ||
m= g ( r.sub,p.sub) && r.obj == p.obj &&r.act ==p.act |
Submodule casbin-redis-adapter
added at
90e577
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Compiled Object files, Static and Dynamic libs (Shared Objects) | ||
*.o | ||
*.a | ||
*.so | ||
|
||
# Folders | ||
_obj | ||
_test | ||
|
||
# Architecture specific extensions/prefixes | ||
*.[568vq] | ||
[568vq].out | ||
|
||
*.cgo1.go | ||
*.cgo2.c | ||
_cgo_defun.c | ||
_cgo_gotypes.go | ||
_cgo_export.* | ||
|
||
_testmain.go | ||
|
||
*.exe | ||
*.test | ||
*.prof | ||
|
||
.idea/ | ||
*.iml | ||
|
||
# vendor files | ||
vendor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"debug": true, | ||
"branches": [ | ||
"+([0-9])?(.{+([0-9]),x}).x", | ||
"master", | ||
{ | ||
"name": "beta", | ||
"prerelease": true | ||
} | ||
], | ||
"plugins": [ | ||
"@semantic-release/commit-analyzer", | ||
"@semantic-release/release-notes-generator", | ||
"@semantic-release/github" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
language: go | ||
|
||
sudo: false | ||
|
||
env: | ||
- GO111MODULE=on | ||
|
||
go: | ||
- "1.11.13" | ||
- "1.12" | ||
- "1.13" | ||
- "1.14" | ||
|
||
script: | ||
- make test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# How to contribute | ||
|
||
The following is a set of guidelines for contributing to casbin and its libraries, which are hosted at [casbin organization at Github](https://github.com/casbin). | ||
|
||
This project adheres to the [Contributor Covenant 1.2.](https://www.contributor-covenant.org/version/1/2/0/code-of-conduct.html) By participating, you are expected to uphold this code. Please report unacceptable behavior to [email protected]. | ||
|
||
## Questions | ||
|
||
- We do our best to have an [up-to-date documentation](https://casbin.org/docs/overview) | ||
- [Stack Overflow](https://stackoverflow.com) is the best place to start if you have a question. Please use the [casbin tag](https://stackoverflow.com/tags/casbin/info) we are actively monitoring. We encourage you to use Stack Overflow specially for Modeling Access Control Problems, in order to build a shared knowledge base. | ||
- You can also join our [Discord](https://discord.gg/S5UjpzGZjN). | ||
|
||
## Reporting issues | ||
|
||
Reporting issues are a great way to contribute to the project. We are perpetually grateful about a well-written, through bug report. | ||
|
||
Before raising a new issue, check our [issue list](https://github.com/casbin/casbin/issues) to determine if it already contains the problem that you are facing. | ||
|
||
A good bug report shouldn't leave others needing to chase you for more information. Please be as detailed as possible. The following questions might serve as a template for writing a detailed report: | ||
|
||
What were you trying to achieve? | ||
What are the expected results? | ||
What are the received results? | ||
What are the steps to reproduce the issue? | ||
In what environment did you encounter the issue? | ||
|
||
Feature requests can also be submitted as issues. | ||
|
||
## Pull requests | ||
|
||
Good pull requests (e.g. patches, improvements, new features) are a fantastic help. They should remain focused in scope and avoid unrelated commits. | ||
|
||
Please ask first before embarking on any significant pull request (e.g. implementing new features, refactoring code etc.), otherwise you risk spending a lot of time working on something that the maintainers might not want to merge into the project. | ||
|
||
First add an issue to the project to discuss the improvement. Please adhere to the coding conventions used throughout the project. If in doubt, consult the [Effective Go style guide](https://golang.org/doc/effective_go.html). |
Oops, something went wrong.