utils

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2019 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AESDecrypt

func AESDecrypt(cryted, key string) string

AESDecrypt aes 式で復号化

func AESEncrypt

func AESEncrypt(org, key string) string

AESEncrypt aes 式で暗号化

func BeginningOfDay

func BeginningOfDay(t time.Time) time.Time

BeginningOfDay 指定日の開始を返す.

func BeginningOfLastDay

func BeginningOfLastDay(t time.Time) time.Time

BeginningOfLastDay 前日の開始を返す.

func BeginningOfLastMonth

func BeginningOfLastMonth(t time.Time) time.Time

BeginningOfLastMonth 先月の月初めを返す..

func BeginningOfLastWeek

func BeginningOfLastWeek(t time.Time) time.Time

BeginningOfLastWeek 指定日時の前週の初めを返す.

func BeginningOfMonth

func BeginningOfMonth(t time.Time) time.Time

BeginningOfMonth 今月の月初めを返す.

func BeginningOfNextMonth

func BeginningOfNextMonth(t time.Time) time.Time

BeginningOfNextMonth 来月の月初めを返す..

func BeginningOfWeek

func BeginningOfWeek(t time.Time) time.Time

BeginningOfWeek 指定日時の週初めを返す.

func CalcDateSub

func CalcDateSub(from, to time.Time) (days, hours, mins, secs int)

CalcDateSub 日時の差分をそれぞれ返却する.

func CreateZipFileContent

func CreateZipFileContent(writer *zip.Writer, zipPath string, targetFilePath string) error

CreateZipFileContent Zipファイルの中身を設定する

func DateUTC

func DateUTC(year, month, date int) time.Time

DateUTC 年月日からtime.Time型を生成する

func ExistsInt

func ExistsInt(arrayData []int, val int) bool

ExistsInt returns the value exists in the array.

func ExistsString

func ExistsString(arrayData []string, val string) bool

ExistsString returns the value exists in the array.

func FileExists added in v1.0.2

func FileExists(filename string) bool

FileExists decect if file exists

func FormatDateJST

func FormatDateJST(date time.Time) string

FormatDateJST は JST で日付をフォーマットする.

func FormatDateJSTByNullTime

func FormatDateJSTByNullTime(date null.Time) string

FormatDateJSTByNullTime は null.Time を JST で日付フォーマットした日付を返す. null の場合は空文字を返す.

func FormatDateTimeJST

func FormatDateTimeJST(date time.Time) string

FormatDateTimeJST は JST で日付をフォーマットする.

func FormatDateTimeJSTByNullTime

func FormatDateTimeJSTByNullTime(date null.Time) string

FormatDateTimeJSTByNullTime は null.Time を JST で日付フォーマットした日付(時間を含む)を返す. null の場合は空文字を返す.

func FormatDateTimeOnlyNumber

func FormatDateTimeOnlyNumber(date time.Time) string

FormatDateTimeOnlyNumber は 日付をフォーマットする.

func GenUUID

func GenUUID() string

GenUUID return UUID V4.

func GenerateRandomString

func GenerateRandomString(length int) string

GenerateRandomString ランダム文字列生成

func GetAge

func GetAge(t null.Time) null.Int

GetAge 誕生日から現在の年齢を返す.

func GetEscapeString

func GetEscapeString(str string) string

GetEscapeString return escape string

func GetFowardMatchString

func GetFowardMatchString(str string) string

GetFowardMatchString return foward match query string

func GetMatchString

func GetMatchString(str string) string

GetMatchString return match query string

func IndexOfInt

func IndexOfInt(arrayData []int, val int) int

IndexOfInt returns index of value in the array.

func IntArrayToString

func IntArrayToString(arrayData []int, delimiter string) string

IntArrayToString 数値の配列を delimiter で結合した文字列で返却する.

func IsPasswordRuleEnabled

func IsPasswordRuleEnabled(password string) bool

IsPasswordRuleEnabled パスワードに半角小文字大文字英字と数字を含む8文字以上か

func JSTLocation

func JSTLocation() *time.Location

JSTLocation 現在時間を返す.

func JSTNow

func JSTNow() time.Time

JSTNow 現在時間を返す.

func NullIntIfZero

func NullIntIfZero(i int) null.Int

NullIntIfZero returns null.String. if int is empty, returns null.Int having null value.

func NullStringIfEmpty

func NullStringIfEmpty(s string) null.String

NullStringIfEmpty returns null.String. if string is empty, returns null.String having null value.

func NumberOfTheWeekInMonth

func NumberOfTheWeekInMonth(now time.Time) int

NumberOfTheWeekInMonth は月中の第何週かを返す.

func PKCS7Padding

func PKCS7Padding(ciphertext []byte, blocksize int) []byte

PKCS7Padding get PKCS7 Padding

func PKCS7UnPadding

func PKCS7UnPadding(origData []byte) []byte

PKCS7UnPadding get PKCS7 Unpadding

func RandStringForShortenURL

func RandStringForShortenURL(n int) string

RandStringForShortenURL は短縮URL用のランダム文字を返す.

func RandStringFriendly

func RandStringFriendly(n int) string

RandStringFriendly は引き継ぎコードや問い合わせコードなど視認しやすいランダムコードを得る.

func RemoveNumInArray

func RemoveNumInArray(removeNum int, intArray []int) []int

RemoveNumInArray 指定した数字を数値配列内から全て除去する.

func ResolveHostIP

func ResolveHostIP() string

ResolveHostIP ホストマシンのアドレスを解析する

func Round

func Round(f float64, places int) float64

Round はplaces の位置で四捨五入した値を返却

func SHA256Str

func SHA256Str(str string) string

SHA256Str returns SHA256 has of the string.

func SliceInt

func SliceInt(offset int, limit int, intArray []int) []int

SliceInt 指定した範囲のリストを取得する

func SortMapByValueForFloat

func SortMapByValueForFloat(srcMap map[int]float64) []int

SortMapByValueForFloat Map(key:int,value:float64)をvalue別に降順ソートし、その時に対応するkeyのリストを返す

func SortMapByValueForTime

func SortMapByValueForTime(srcMap map[int]time.Time) []int

SortMapByValueForTime Map(key:int,value:time.Time)をvalue別に降順ソートし、その時に対応するkeyのリストを返す

func StringToIntArray

func StringToIntArray(str string) ([]int, error)

StringToIntArray delimiter で結合された文字列を数値の配列にする.

func SumFloat

func SumFloat(values []float64) float64

SumFloat リストの合計値を計算

func UniqInt

func UniqInt(arrayData []int) []int

UniqInt returns duplicate value in the array.

func WrapArray

func WrapArray(arrayData interface{}) map[string]Element

WrapArray Array elements to object

func WrapArrayWithElemName

func WrapArrayWithElemName(arrayData interface{}, elemName string) map[string]Element

WrapArrayWithElemName Array elements to object with field name.

Types

type Element

type Element interface{}

Element Array elements as object

Jump to

Keyboard shortcuts

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