dogo

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2022 License: MIT Imports: 39 Imported by: 0

README

介绍

本项目提炼go开发web项目中的经验和积累,组合中间件、第三方依赖,快速创建基于Go的web应用。本项目借鉴了:

  • Ruby on Rails
  • Django
  • Gin
  • HttpClient
  • log4j
  • xorm

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	PrivateKey string
	PublicKey  string
)

Functions

func ApplyTemplate

func ApplyTemplate(temp string, data map[string]interface{}) (string, error)

渲染模板

func ClientGo added in v0.0.10

func ClientGo() *kubernetes.Clientset

func ClientGoDynamic added in v0.0.10

func ClientGoDynamic() dynamic.Interface

func Debug

func Debug(v ...interface{})

func Debugf

func Debugf(format string, v ...interface{})

func DecodeBase64

func DecodeBase64(in string) (string, error)

解密base64

func DecodeURLBase64

func DecodeURLBase64(in string) (string, error)

func EditFormColumns

func EditFormColumns(data map[string]string, dbinfo map[string][]byte) string

func EncodeBase64

func EncodeBase64(in string) string

加密base64

func Error

func Error(v ...interface{})

func Errorf

func Errorf(format string, v ...interface{})

func ExecCommand

func ExecCommand(cmd string) ([]byte, error)

func ExecCommandString

func ExecCommandString(cmd string) (string, error)

func Fatal

func Fatal(v ...interface{})

func Fatalf

func Fatalf(format string, v ...interface{})

func FuncMap

func FuncMap() template.FuncMap

获取FuncMap

func GenerateRSAKey

func GenerateRSAKey(bits int) error

生成RSA私钥和公钥,保存到文件中

func GetCurrentDirectory

func GetCurrentDirectory() string

func GetIPs

func GetIPs() (ips []string)

func GetMacAddrs

func GetMacAddrs() (macAddrs []string)

0:cf:e0:44:dd:be,enp1s0

func GetRandomSalt

func GetRandomSalt() string

return len=8 salt

func GetRandomString

func GetRandomString(len int) string

生成随机字符串

func GetRegisterByName

func GetRegisterByName(name string) map[string]string

func GetRegistered

func GetRegistered() []map[string]string

func Http added in v0.0.10

func Http() *utils.GoutCli

func Info

func Info(v ...interface{})

func Infof

func Infof(format string, v ...interface{})

func Jiami

func Jiami(code string) string

加密

func MD5

func MD5(text string) string

生成32位MD5

func NewHttpProxyByGinCustom added in v0.0.10

func NewHttpProxyByGinCustom(target string, filter map[string]string) func(c *gin.Context)

func Register

func Register(data ...interface{}) error

注册Model

func RsaBase64Encode

func RsaBase64Encode(origData string) string

func RsaBase64UrlDecode

func RsaBase64UrlDecode(origData string) ([]byte, error)

func RsaDecrypt

func RsaDecrypt(ciphertext []byte) ([]byte, error)

解密RSA

func RsaEncrypt

func RsaEncrypt(origData []byte) ([]byte, error)

加密RSA

func Run

func Run(ishttps bool)

func SendErrorMessage added in v0.0.10

func SendErrorMessage(c *gin.Context, code int, errorCode string, errorMsg string)

func SendSuccessMessage added in v0.0.10

func SendSuccessMessage(c *gin.Context, code int, data interface{})

func Trace

func Trace(v ...interface{})

func Tracef

func Tracef(format string, v ...interface{})

func Warn

func Warn(v ...interface{})

func Warnf

func Warnf(format string, v ...interface{})

func WriteFile

func WriteFile(path string, data []byte) (int, error)

写文件

Types

type Core

type Core interface {
	Engine() *gin.Engine
	Logger() log.Logger
	HttpClient() *gout.Client
	Orm() *xorm.Engine
	Cache() *cache.Cache
}

type Rails

type Rails struct {
	slog.Logger
	*gin.Engine
	HttpClient *gout.Client
	Http       *utils.GoutCli
	Orm        *xorm.Engine
	Cache      *cache.Cache
}
var (
	GoOnRails *Rails
)

func NewRails

func NewRails() *Rails

Jump to

Keyboard shortcuts

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