oez

package
v0.0.0-...-553f247 Latest Latest
Warning

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

Go to latest
Published: May 13, 2021 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
	SCALE = 62
	REGEX = "^[0-9a-zA-Z]+$"
	NUM   = 6
)

Variables

View Source
var CHARS = "InsV3Sf0obzp2i4gj1yYGqQv6wUtmBxlMAP7KHd8uTXFk9aRJWNC5EOhZDcLer"
View Source
var Config = new(ConfigConf)
View Source
var DB *gorm.DB

Functions

func CreatNestedFile

func CreatNestedFile(path string) (*os.File, error)

CreatNestedFile 给定path创建文件,如果目录不存在就递归创建

func CreateUrl

func CreateUrl(c *gin.Context)

func Decode62To10

func Decode62To10(val string) (uint, error)

func Encode10To62

func Encode10To62(val uint) string

func Exists

func Exists(name string) bool

Exists reports whether the named file or directory exists.

func GetUrl

func GetUrl(c *gin.Context)

func GetUrlJSON

func GetUrlJSON(c *gin.Context)

func Index

func Index(c *gin.Context)

func Init

func Init() bool

func InitConf

func InitConf(conf string) bool

func InitGin

func InitGin(r *gin.Engine)

func IsEmpty

func IsEmpty(name string) (bool, error)

IsEmpty 返回给定目录是否为空目录

func RandomStr

func RandomStr(str string) string

func ReadConf

func ReadConf(conf string) bool

func RelativePath

func RelativePath(name string) string

RelativePath 获取相对可执行文件的路径

func Run

func Run()

Types

type CommonConf

type CommonConf struct {
	Chars  string `yaml:"chars"`
	Listen string `yaml:"listen"`
	Debug  bool   `yaml:"debug"`
	Title  string `yaml:"title"`
}

type ConfigConf

type ConfigConf struct {
	Common   CommonConf   `yaml:"common"`
	Database DatabaseConf `yaml:"database"`
}

type DatabaseConf

type DatabaseConf struct {
	Type        string `yaml:"type"`
	User        string `yaml:"user"`
	Password    string `yaml:"password"`
	Host        string `yaml:"host"`
	Port        int    `yaml:"port"`
	Name        string `yaml:"name"`
	TablePrefix string `yaml:"tablePrefix"`
	DBFile      string `yaml:"dBFile"`
}

type Url

type Url struct {
	gorm.Model
	Url      string `json:"url" form:"url" gorm:"type:varchar(512)"`
	Times    uint
	ClientIP string `gorm:"type:varchar(64)"`
}

func Get

func Get(str string) (*Url, error)

func (*Url) Create

func (url *Url) Create() (uint, error)

func (*Url) Look

func (url *Url) Look()

Jump to

Keyboard shortcuts

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