crane

package module
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 2, 2020 License: MIT Imports: 11 Imported by: 0

README

Crane

Configurable integration tool

Description

Crane It is not a framework, but a layer of three-party libraries that may be needed for daily use, so that some libraries can support automatic reloading by modifying the configuration, making web development more convenient, instead of integrating various libraries before development Tools, bother

Installation
  • go get
go get -u github.com/kenretto/crane
  • git submodule
    • git submodule add
      git submodule add https://github.com/kenretto/crane.git 
      
    • go.mod replace (open go.mod)
      replace (
      	github.com/kenretto/crane version hash => your submodule crane path
      )
      
Examples
Usage

If you are using the method build in the example, launch the Crane.Run method start, Then, using buildout-binary start will make the service separate from the parent process that started it, and run in the mode of daemon, If you run with buildout-binary start --daemon=false, the service will remain in the current session(this will facilitate debugging at development time, such as using GoLand)

Documentation

Overview

Package crane ...

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Crane

type Crane struct {
	Configurator *configurator.Configurator

	Password *password.Password
	Redis    *redis.Redis
	// contains filtered or unexported fields
}

Crane summarize sub-package configuration

func NewCrane

func NewCrane(config string) (crane *Crane, err error)

NewCrane 子目录的每个库其实都是可以单独使用的, 如果想要整个依赖, 建议使用这个方法来初始化

func (*Crane) Captcha

func (crane *Crane) Captcha() *captcha.Captcha

Captcha 获取验证码操作

func (*Crane) Handler

func (crane *Crane) Handler(handler func(router *gin.Engine))

Handler set handler

func (*Crane) Logger

func (crane *Crane) Logger() *logrus.Logger

Logger 获取 logger

func (*Crane) ORM

func (crane *Crane) ORM(db ...string) *gorm.DB

ORM 获取 gorm 的操作

func (*Crane) Run

func (crane *Crane) Run()

Run start service

func (*Crane) Sessions

func (crane *Crane) Sessions() *sessions.Sessions

Sessions get sessions

type Logger

type Logger struct {
	*logrus.Logger
}

Logger encapsulating logrus

func (*Logger) WithFields

func (logger *Logger) WithFields(fields server.Fields) server.ILogger

WithFields encapsulating logrus

Directories

Path Synopsis
Package areacode International area code and time zone
Package areacode International area code and time zone
orm
Package i18n i18n 国际化 example: bundle := i18n.NewBundle(language.Chinese).LoadFiles("./locales", toml.Unmarshal) log.Println(bundle.NewPrinter(language.English).Translate("Hello", i18n.Data{"name": "medivh", "count": 156}, 156)) # return 你好世界
Package i18n i18n 国际化 example: bundle := i18n.NewBundle(language.Chinese).LoadFiles("./locales", toml.Unmarshal) log.Println(bundle.NewPrinter(language.English).Translate("Hello", i18n.Data{"name": "medivh", "count": 156}, 156)) # return 你好世界
Package sensitivewords 敏感词过滤 example: words := sensitivewords.NewSensitiveWords().LoadKeywords(app.Root() + "/configs/debug/keywords.csv") fmt.Println(words.HasKeywords("鸡巴"))
Package sensitivewords 敏感词过滤 example: words := sensitivewords.NewSensitiveWords().LoadKeywords(app.Root() + "/configs/debug/keywords.csv") fmt.Println(words.HasKeywords("鸡巴"))
Package unique sony 雪花算法, 生成有序id
Package unique sony 雪花算法, 生成有序id
request
Package request 本项目对外发起请求使用此包
Package request 本项目对外发起请求使用此包

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL