Categorygithub.com/cyub/hyper
modulepackage
1.1.0
Repository: https://github.com/cyub/hyper.git
Documentation: pkg.go.dev

# README

Hyper

Hyper is a lightweight and easy-to-use framework. The hyper framework works out of the box. It has built-in commonly used components, you only need to turn it on according to your needs.

Feature

  • Based on gin framework, Lightweight and easy to use
  • Config
    • Based on spf13/viper package
    • Support local files (yaml format) and consul
  • Logger
    • Base on sirupsen/logrus package
    • Support multiple output sources (stdout/stderr/file)
    • Support text or json format log output
  • Queue
    • Support redis and kafka two types of queue storage backend
    • Ability to recover from abnormal consumption tasks
    • Support consumer task failure retry function
    • Built-in prometheus exporter, you can review your queue
  • Mysql
    • Base on go-gorm/gorm package
    • The maximum number of connections, enable sql log and other settings only need to be configured
  • Discover
    • Support Consul-based service registration and discovery
  • Selector
    • Support getting nodes from Discover for load balancing
    • Support RoundRobin strategy
  • Cache
    • Support redis as a storage backend
  • Built-in performance analysis tool pprof

Install and Use

Install

go get -u github.com/cyub/hyper/cmd/[email protected]

Create Application

cd www/
hyper new your_project_name

Run Application

cd your_project_name
make run

If an error message like github.com/coreos/[email protected]+incompatible/client/keys.generated.go:63:14: z.HasExtensions appears during operation, remove this keys.generated.go file to solve the problem

Access Application

curl localhost:8000/welcome

# Packages

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Functions

AddCronJob use add cron job.
Cache return cache.Cache.
Config return config.Config.
DB return gorm.DB.
InQueue use for job enqueue.
InQueueWithRetry use for job enqueue.
Logger return logrus.Logger.
NewApp return application.
NewJob return job.
Queue return queue.Queue.
Redis return redis.Client.
RedisCluster return redis.ClusterClient.
Registry return registry.Registry.
WithAddr use for set app's addr.
WithCfgAddr use for set app's config center addr.
WithCfgPath use for set app's config center path.
WithCron use for set user defined cron object.
WithCronEnable use for enable cron.
WithHideBanner use for set hide hyper banner.
WithName use for set app's name.
WithRunMode use for set app's run mode.