lib

package module
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2016 License: Apache-2.0 Imports: 8 Imported by: 0

README

Golang常用函数库

包中的所有函数都源于开发过程中的积累

获取

$ go get -v gopkg.in/LyricTian/lib.v1

License

Copyright 2016.All rights reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Encryption added in v1.0.4

type Encryption struct {
	// contains filtered or unexported fields
}

Encryption 提供加密操作

func NewEncryption added in v1.0.4

func NewEncryption(v []byte) *Encryption

NewEncryption 创建Encryption的实例 v 需要加密的值

func (*Encryption) MD5 added in v1.0.4

func (e *Encryption) MD5() (string, error)

MD5 MD5加密

type Interface

type Interface interface {
	// ToString Convert interface{} to string
	ToString() string
	// ToBytes Convert interface{} to []byte
	ToBytes() []byte
	// ToString Convert interface{} to int64
	ToInt64() int64
	// ToString Convert interface{} to int32
	ToInt32() int32
	// ToString Convert interface{} to int
	ToInt() int
	// ToString Convert interface{} to uint64
	ToUint64() uint64
	// ToString Convert interface{} to uint32
	ToUint32() uint32
	// ToString Convert interface{} to float64
	ToFloat64() float64
	// ToString Convert interface{} to float32
	ToFloat32() float32
	// ToString Convert interface{} to bool
	ToBool() bool
	// ToString Convert interface{} to time,
	// // If error isn't nil return time.Now()
	ToTime(layout string) time.Time
}

Interface Provide a interface{} convert operation

func T

func T(v interface{}) Interface

T Interface instance

type Random added in v1.0.3

type Random struct {
	// contains filtered or unexported fields
}

Random 提供随机码的生成函数

func NewRandom added in v1.0.3

func NewRandom(l int) *Random

NewRandom 创建Random的实例 l 生成随机码的长度

func (*Random) LowerLetter added in v1.0.3

func (rd *Random) LowerLetter() string

LowerLetter 生成只包含小写字母的随机码

func (*Random) Number added in v1.0.3

func (rd *Random) Number() string

Number 生成只包含数字的随机码

func (*Random) NumberAndLetter added in v1.0.3

func (rd *Random) NumberAndLetter() string

NumberAndLetter 生成包含数字和字母(不区分大小写)的随机码

func (*Random) Source added in v1.0.3

func (rd *Random) Source(source []byte) string

Source 从指定的数据源生成随机码

func (*Random) UpperLetter added in v1.0.3

func (rd *Random) UpperLetter() string

UpperLetter 生成只包含大写字母的随机码

type Str

type Str string

Str Provide a string convert operation

func (Str) ToBool

func (s Str) ToBool() bool

ToBool Convert string to bool

func (Str) ToBuffer

func (s Str) ToBuffer() *bytes.Buffer

ToBuffer Convert string to buffer

func (Str) ToBytes

func (s Str) ToBytes() []byte

ToBytes Convert string to []byte

func (Str) ToFloat32

func (s Str) ToFloat32() float32

ToFloat32 Convert string to float32

func (Str) ToFloat64

func (s Str) ToFloat64() float64

ToFloat64 Convert string to float64

func (Str) ToInt

func (s Str) ToInt() int

ToInt Convert string to int

func (Str) ToInt32

func (s Str) ToInt32() int32

ToInt32 Convert string to int32

func (Str) ToInt64

func (s Str) ToInt64() int64

ToInt64 Convert string to int64

func (Str) ToString

func (s Str) ToString() string

ToString Convert string to string

func (Str) ToTime

func (s Str) ToTime(layout string) time.Time

ToTime Convert string to time, If error isn't nil return time.Now()

func (Str) ToUint32

func (s Str) ToUint32() uint32

ToUint32 Convert string to uint32

func (Str) ToUint64

func (s Str) ToUint64() uint64

ToUint64 Convert string to uint64

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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