Documentation ¶
Overview ¶
Package sunshine is a powerful Go development framework, it's easy to develop web and microservice projects. repo: https://github.com/18721889353/sunshine docs: https://go-sunshine.com
Usage: sunshine [command]
Available Commands: completion Generate the autocompletion script for the specified shell config Generate go config code from yaml file configmap Generate k8s configmap help Help about any command init Initialize sunshine merge Merge the generated code into the template file micro Generate protobuf, model, cache, dao, service, grpc, grpc+http, grpc-gw, grpc-cli code patch Command set for patching service code plugins Managing sunshine dependency plugins run Run the sunshine ui service upgrade Upgrade sunshine version web Generate model, cache, dao, handler, http code
Flags: -h, --help help for sunshine -v, --version version for sunshine
Use "sunshine [command] --help" for more information about a command.
Directories ¶
Path | Synopsis |
---|---|
api
|
|
cmd
|
|
protoc-gen-go-gin
Package main generate *.go(tmpl), *_router.go, *_http.go, *_router.pb.go code based on proto files.
|
Package main generate *.go(tmpl), *_router.go, *_http.go, *_router.pb.go code based on proto files. |
protoc-gen-go-gin/internal/generate/handler
Package handler is to generate template code, router code, and error code.
|
Package handler is to generate template code, router code, and error code. |
protoc-gen-go-gin/internal/generate/router
Package router 是用于生成 Gin 路由代码的包。
|
Package router 是用于生成 Gin 路由代码的包。 |
protoc-gen-go-gin/internal/generate/service
Package service is to generate template code, router code, and error code.
|
Package service is to generate template code, router code, and error code. |
protoc-gen-go-rpc-tmpl
Package main is to generate *.go(tmpl), *_client_test.go, *_rpc.go files.
|
Package main is to generate *.go(tmpl), *_client_test.go, *_rpc.go files. |
protoc-gen-go-rpc-tmpl/internal/generate/service
Package service is to generate template code, test code, and error code.
|
Package service is to generate template code, test code, and error code. |
protoc-gen-go-rpc-tmpl/internal/parse
Package parse is parsed proto file to struct
|
Package parse is parsed proto file to struct |
protoc-gen-json-field
Package main is a library that parses protobuf files into json
|
Package main is a library that parses protobuf files into json |
protoc-gen-json-field/generate
Package generate is generate json field code.
|
Package generate is generate json field code. |
protoc-gen-json-field/parser
Package parser is parsed proto file to struct
|
Package parser is parsed proto file to struct |
serverNameExample_grpcExample
Package main is the grpc server of the application.
|
Package main is the grpc server of the application. |
serverNameExample_grpcExample/initial
Package initial is the package that starts the service to initialize the service, including the initialization configuration, service configuration, connecting to the database, and resource release needed when shutting down the service.
|
Package initial is the package that starts the service to initialize the service, including the initialization configuration, service configuration, connecting to the database, and resource release needed when shutting down the service. |
serverNameExample_grpcGwPbExample
Package main is the grpc gateway server of the application.
|
Package main is the grpc gateway server of the application. |
serverNameExample_grpcGwPbExample/initial
Package initial is the package that starts the service to initialize the service, including the initialization configuration, service configuration, connecting to the database, and resource release needed when shutting down the service.
|
Package initial is the package that starts the service to initialize the service, including the initialization configuration, service configuration, connecting to the database, and resource release needed when shutting down the service. |
serverNameExample_grpcHttpPbExample
Package main is the http and grpc server of the application.
|
Package main is the http and grpc server of the application. |
serverNameExample_grpcHttpPbExample/initial
Package initial is the package that starts the service to initialize the service, including the initialization configuration, service configuration, connecting to the database, and resource release needed when shutting down the service.
|
Package initial is the package that starts the service to initialize the service, including the initialization configuration, service configuration, connecting to the database, and resource release needed when shutting down the service. |
serverNameExample_grpcPbExample
Package main is the grpc server of the application.
|
Package main is the grpc server of the application. |
serverNameExample_grpcPbExample/initial
Package initial is the package that starts the service to initialize the service, including the initialization configuration, service configuration, connecting to the database, and resource release needed when shutting down the service.
|
Package initial is the package that starts the service to initialize the service, including the initialization configuration, service configuration, connecting to the database, and resource release needed when shutting down the service. |
serverNameExample_httpExample
Package main is the http server of the application.
|
Package main is the http server of the application. |
serverNameExample_httpExample/initial
Package initial is the package that starts the service to initialize the service, including the initialization configuration, service configuration, connecting to the database, and resource release needed when shutting down the service.
|
Package initial is the package that starts the service to initialize the service, including the initialization configuration, service configuration, connecting to the database, and resource release needed when shutting down the service. |
serverNameExample_httpPbExample
Package main is the http server of the application.
|
Package main is the http server of the application. |
serverNameExample_httpPbExample/initial
Package initial is the package that starts the service to initialize the service, including the initialization configuration, service configuration, connecting to the database, and resource release needed when shutting down the service.
|
Package initial is the package that starts the service to initialize the service, including the initialization configuration, service configuration, connecting to the database, and resource release needed when shutting down the service. |
serverNameExample_mixExample
Package main is the http and grpc server of the application.
|
Package main is the http and grpc server of the application. |
serverNameExample_mixExample/initial
Package initial is the package that starts the service to initialize the service, including the initialization configuration, service configuration, connecting to the database, and resource release needed when shutting down the service.
|
Package initial is the package that starts the service to initialize the service, including the initialization configuration, service configuration, connecting to the database, and resource release needed when shutting down the service. |
sunshine
Package main sunshine is a basic development framework that integrates code auto generation, Gin and GRPC, a microservice framework.
|
Package main sunshine is a basic development framework that integrates code auto generation, Gin and GRPC, a microservice framework. |
sunshine/commands
Package commands 包含 sunshine 命令的所有子命令。
|
Package commands 包含 sunshine 命令的所有子命令。 |
sunshine/commands/generate
Package generate is to generate code, including model, cache, dao, handler, http, service, grpc, grpc-gw, grpc-cli code.
|
Package generate is to generate code, including model, cache, dao, handler, http, service, grpc, grpc-gw, grpc-cli code. |
sunshine/commands/merge
Package merge is merge the generated code into the template file, you don't worry about it affecting the logic code you have already written, in case of accidents, you can find the pre-merge code in the directory /tmp/sunshine_merge_backup_code
|
Package merge is merge the generated code into the template file, you don't worry about it affecting the logic code you have already written, in case of accidents, you can find the pre-merge code in the directory /tmp/sunshine_merge_backup_code |
sunshine/commands/patch
Package patch is command set for patching service code.
|
Package patch is command set for patching service code. |
sunshine/commands/template
Package template provides commands to generate custom code.
|
Package template provides commands to generate custom code. |
sunshine/server
Package server is a sunshine UI service that contains the front-end pages.
|
Package server is a sunshine UI service that contains the front-end pages. |
Package configs used to locate config file.
|
Package configs used to locate config file. |
internal
|
|
cache
Package cache is a package that unifies the definition of caching, supporting both redis and local caching.
|
Package cache is a package that unifies the definition of caching, supporting both redis and local caching. |
dao
Package dao is the data access object, the code for database operation is unified here.
|
Package dao is the data access object, the code for database operation is unified here. |
database
Package database provides database client initialization.
|
Package database provides database client initialization. |
ecode
Package ecode is the package that unifies the definition of http error codes or grpc error codes here.
|
Package ecode is the package that unifies the definition of http error codes or grpc error codes here. |
handler
Package handler is a package of http request processing business logic.
|
Package handler is a package of http request processing business logic. |
model
Package model contains the data models used in the application.
|
Package model contains the data models used in the application. |
routers
Package routers is a package dedicated to registering routes, and supports both manual route registration and automatic route registration.
|
Package routers is a package dedicated to registering routes, and supports both manual route registration and automatic route registration. |
rpcclient
Package rpcclient is the rpc client package, used to connect to grpc server, rich plugin support by default, such as service discovery, load balancing, link tracking and so on.
|
Package rpcclient is the rpc client package, used to connect to grpc server, rich plugin support by default, such as service discovery, load balancing, link tracking and so on. |
server
Package server is a package that holds the http or grpc service.
|
Package server is a package that holds the http or grpc service. |
service
Package service A grpc server-side or client-side package that handles business logic.
|
Package service A grpc server-side or client-side package that handles business logic. |
types
Package types define the structure of request parameters and return results in this package
|
Package types define the structure of request parameters and return results in this package |
pkg
|
|
app
Package app 负责优雅地启动和停止服务,使用 golang.org/x/sync/errgroup 确保多个服务同时启动。
|
Package app 负责优雅地启动和停止服务,使用 golang.org/x/sync/errgroup 确保多个服务同时启动。 |
cache
Package cache is redis cache libraries.
|
Package cache is redis cache libraries. |
conf
Package conf 是解析 YAML、JSON、TOML 配置文件到 Go 结构体的包。
|
Package conf 是解析 YAML、JSON、TOML 配置文件到 Go 结构体的包。 |
consulcli
Package consulcli 是连接到 Consul 服务的客户端包。
|
Package consulcli 是连接到 Consul 服务的客户端包。 |
container/group
Package group provides a sample lazy load container.
|
Package group provides a sample lazy load container. |
dlock
Package dlock 提供分布式锁原语,支持 Redis 和 etcd。
|
Package dlock 提供分布式锁原语,支持 Redis 和 etcd。 |
dump
Package dump like fmt.Println but more pretty and beautiful print Go values.
|
Package dump like fmt.Println but more pretty and beautiful print Go values. |
encoding
Package encoding Provides encoding and decoding of json, protobuf and gob.
|
Package encoding Provides encoding and decoding of json, protobuf and gob. |
encoding/json
Package json is a JSON encoding and decoding.
|
Package json is a JSON encoding and decoding. |
encoding/proto
Package proto is a protobuf encoding and decoding.
|
Package proto is a protobuf encoding and decoding. |
errcode
Package errcode 用于定义 HTTP 和 gRPC 错误码,包括系统级别的错误码和业务级别的错误码
|
Package errcode 用于定义 HTTP 和 gRPC 错误码,包括系统级别的错误码和业务级别的错误码 |
etcdcli
Package etcdcli 用于连接到 etcd 服务
|
Package etcdcli 用于连接到 etcd 服务 |
ggorm
Package ggorm is a library wrapped on top of gorm.io/gorm, with added features such as link tracing, paging queries, etc.
|
Package ggorm is a library wrapped on top of gorm.io/gorm, with added features such as link tracing, paging queries, etc. |
ggorm/query
Package query is a library of custom condition queries, support for complex conditional paging queries.
|
Package query is a library of custom condition queries, support for complex conditional paging queries. |
gin/frontend
Package frontend embeds the frontend static file and adds routing.
|
Package frontend embeds the frontend static file and adds routing. |
gin/handlerfunc
Package handlerfunc is used for public http request handler.
|
Package handlerfunc is used for public http request handler. |
gin/middleware
Package middleware is gin middleware plugin.
|
Package middleware is gin middleware plugin. |
gin/middleware/metrics
Package metrics is gin metrics library, collect five metrics, "uptime", "http_request_count_total", "http_request_duration_seconds", "http_request_size_bytes", "http_response_size_bytes".
|
Package metrics is gin metrics library, collect five metrics, "uptime", "http_request_count_total", "http_request_duration_seconds", "http_request_size_bytes", "http_response_size_bytes". |
gin/prof
Package prof is used for gin profiling.
|
Package prof is used for gin profiling. |
gin/response
Package response provides wrapper gin returns json data in the same format.
|
Package response provides wrapper gin returns json data in the same format. |
gin/swagger
Package swagger is gin swagger library.
|
Package swagger is gin swagger library. |
gin/validator
Package validator is gin request parameter check library.
|
Package validator is gin request parameter check library. |
gobash
Package gobash provides the ability to execute commands, scripts, executables in the go environment with live log output.
|
Package gobash provides the ability to execute commands, scripts, executables in the go environment with live log output. |
gocron
Package gocron is scheduled task library.
|
Package gocron is scheduled task library. |
gocrypto
Package gocrypto is commonly used one-way encryption, symmetric encryption and decryption, asymmetric encryption and decryption libraries, including hash, aes, des, rsa.
|
Package gocrypto is commonly used one-way encryption, symmetric encryption and decryption, asymmetric encryption and decryption libraries, including hash, aes, des, rsa. |
gocrypto/wcipher
Package wcipher is a package to encrypt and decrypt data.
|
Package wcipher is a package to encrypt and decrypt data. |
gofile
Package gofile is file and directory management libraries.
|
Package gofile is file and directory management libraries. |
gohttp
Package gohttp is http request client, which only supports returning json format.
|
Package gohttp is http request client, which only supports returning json format. |
goredis
Package goredis is a library wrapped on top of github.com/go-redis/redis.
|
Package goredis is a library wrapped on top of github.com/go-redis/redis. |
gotest
Package gotest is a library that simulates the testing of cache, dao and handler.
|
Package gotest is a library that simulates the testing of cache, dao and handler. |
grpc/benchmark
Package benchmark is compression testing of rpc methods and generation of reported results.
|
Package benchmark is compression testing of rpc methods and generation of reported results. |
grpc/client
Package client is generic grpc client-side.
|
Package client is generic grpc client-side. |
grpc/grpccli
Package grpccli is grpc client with support for service discovery, logging, load balancing, trace, metrics, retries, circuit breaker.
|
Package grpccli is grpc client with support for service discovery, logging, load balancing, trace, metrics, retries, circuit breaker. |
grpc/gtls
Package gtls provides grpc secure connectivity, supporting both server-only authentication and client-server authentication.
|
Package gtls provides grpc secure connectivity, supporting both server-only authentication and client-server authentication. |
grpc/gtls/certfile
Package certfile is used to locate the certificate file.
|
Package certfile is used to locate the certificate file. |
grpc/interceptor
Package interceptor provides commonly used grpc client-side and server-side interceptors.
|
Package interceptor provides commonly used grpc client-side and server-side interceptors. |
grpc/keepalive
Package keepalive is setting grpc keepalive parameters.
|
Package keepalive is setting grpc keepalive parameters. |
grpc/metrics
Package metrics is grpc's server-side and client-side metrics can continue to be captured using prometheus.
|
Package metrics is grpc's server-side and client-side metrics can continue to be captured using prometheus. |
grpc/resolve
Package resolve is setting grpc client-side load balancing policy.
|
Package resolve is setting grpc client-side load balancing policy. |
grpc/server
Package server is generic grpc server-side.
|
Package server is generic grpc server-side. |
httpcli
Package httpcli is http request client, which only supports return json format.
|
Package httpcli is http request client, which only supports return json format. |
jwt
Package jwt is token generation and validation.
|
Package jwt is token generation and validation. |
jy2struct
Package jy2struct is a library for generating go struct code, supporting json and yaml.
|
Package jy2struct is a library for generating go struct code, supporting json and yaml. |
kafka
Package kafka is a kafka client package.
|
Package kafka is a kafka client package. |
krand
Package krand is a library for generating random strings, integers, floating point numbers.
|
Package krand is a library for generating random strings, integers, floating point numbers. |
logger
Package logger is log library encapsulated in https://github.com/uber-go/zap
|
Package logger is log library encapsulated in https://github.com/uber-go/zap |
mgo
Package mgo is a library wrapped on go.mongodb.org/mongo-driver/mongo, with added features paging queries, etc.
|
Package mgo is a library wrapped on go.mongodb.org/mongo-driver/mongo, with added features paging queries, etc. |
mgo/query
Package query is a library of custom condition queries, support for complex conditional paging queries.
|
Package query is a library of custom condition queries, support for complex conditional paging queries. |
mysql
Package mysql is a library wrapped on top of gorm.io/gorm, with added features such as link tracing, paging queries, etc.
|
Package mysql is a library wrapped on top of gorm.io/gorm, with added features such as link tracing, paging queries, etc. |
mysql/query
Package query is a library for mysql query, support for complex conditional paging queries.
|
Package query is a library for mysql query, support for complex conditional paging queries. |
prof
Package prof is wrap the official `net/http/pprof` route and add the profile io wait time route.
|
Package prof is wrap the official `net/http/pprof` route and add the profile io wait time route. |
rabbitmq
Package rabbitmq is a go wrapper for github.com/rabbitmq/amqp091-go
|
Package rabbitmq is a go wrapper for github.com/rabbitmq/amqp091-go |
replacer
Package replacer 是一个用于替换文件内容的库,支持本地目录和嵌入目录文件的替换。
|
Package replacer 是一个用于替换文件内容的库,支持本地目录和嵌入目录文件的替换。 |
servicerd/discovery
Package discovery is service discovery library, supports etcd, consul and nacos.
|
Package discovery is service discovery library, supports etcd, consul and nacos. |
servicerd/registry
Package registry 是一个服务注册库,支持 etcd、consul 和 nacos。
|
Package registry 是一个服务注册库,支持 etcd、consul 和 nacos。 |
servicerd/registry/etcd
Package etcd is registered as a service using etcd.
|
Package etcd is registered as a service using etcd. |
sgorm
Package sgorm is a library encapsulated on gorm.io/gorm
|
Package sgorm is a library encapsulated on gorm.io/gorm |
sgorm/dbclose
Package dbclose provides a function to close gorm db.
|
Package dbclose provides a function to close gorm db. |
sgorm/glog
Package glog provides a gorm logger implementation based on zap.
|
Package glog provides a gorm logger implementation based on zap. |
sgorm/mysql
Package mysql provides a gorm driver for mysql.
|
Package mysql provides a gorm driver for mysql. |
sgorm/postgresql
Package postgresql provides a gorm driver for postgresql.
|
Package postgresql provides a gorm driver for postgresql. |
sgorm/query
Package query is a library of custom condition queries, support for complex conditional paging queries.
|
Package query is a library of custom condition queries, support for complex conditional paging queries. |
sgorm/sqlite
Package sqlite provides a gorm driver for sqlite.
|
Package sqlite provides a gorm driver for sqlite. |
shield/circuitbreaker
Package circuitbreaker is an adaptive circuit breaker library, support for use in gin middleware and grpc interceptors.
|
Package circuitbreaker is an adaptive circuit breaker library, support for use in gin middleware and grpc interceptors. |
shield/cpu
Package cpu is a library that calculates cpu and memory usage.
|
Package cpu is a library that calculates cpu and memory usage. |
shield/ratelimit
Package ratelimit is an adaptive rate limit library, support for use in gin middleware and grpc interceptors.
|
Package ratelimit is an adaptive rate limit library, support for use in gin middleware and grpc interceptors. |
shield/window
Package window is a library that calculates windows cpu and memory usage.
|
Package window is a library that calculates windows cpu and memory usage. |
sql2code
Package sql2code 提供根据 SQL 生成不同用途代码的功能, 支持生成 JSON、GORM 模型、更新参数、请求参数代码, SQL 可以从参数、文件、数据库三种方式获取,优先级从高到低。
|
Package sql2code 提供根据 SQL 生成不同用途代码的功能, 支持生成 JSON、GORM 模型、更新参数、请求参数代码, SQL 可以从参数、文件、数据库三种方式获取,优先级从高到低。 |
sql2code/parser
Package parser is a library that parses to go structures based on sql and generates the code needed based on the template.
|
Package parser is a library that parses to go structures based on sql and generates the code needed based on the template. |
sqlparser/ast
Package ast is the abstract syntax tree parsed from a SQL statement by parser.
|
Package ast is the abstract syntax tree parsed from a SQL statement by parser. |
stat
Package stat provides for counting system and process cpu and memory information, alarm notification support.
|
Package stat provides for counting system and process cpu and memory information, alarm notification support. |
stat/cpu
Package cpu is a library that counts system and process cpu usage.
|
Package cpu is a library that counts system and process cpu usage. |
stat/mem
Package mem is a library that counts system and process memory usage.
|
Package mem is a library that counts system and process memory usage. |
tracer
Package tracer is a library wrapped in go.opentelemetry.io/otel.
|
Package tracer is a library wrapped in go.opentelemetry.io/otel. |
utils
Package utils is a library of commonly used utility functions.
|
Package utils is a library of commonly used utility functions. |
ws
Package ws provides a WebSocket server implementation.
|
Package ws provides a WebSocket server implementation. |