utils

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Copyright © 2020 Marvin

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.

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.

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.

Index

Constants

View Source
const (
	UpdateOperation        = "UPDATE"
	InsertOperation        = "INSERT"
	DeleteOperation        = "DELETE"
	TruncateOperation      = "TRUNCATE"
	DropOperation          = "DROP"
	DDLOperation           = "DDL"
	TruncateTableOperation = "TRUNCATE TABLE"
	DropTableOperation     = "DROP TABLE"
)

同步操作类型

View Source
const (
	OracleGBKCharacterSet  = "GBK"
	OracleUTF8CharacterSet = "UTF8"
	// oracle collation 默认大小写敏感,a != A
	OracleCollationBin = "BIN"
	// MySQL 支持 check 约束版本 > 8.0.15
	MySQLCheckConsVersion = "8.0.15"
	// MySQL 版本分隔符号
	MySQLVersionDelimiter = "-"
	// MySQL 字符集/排序规则
	MySQLCharacterSet = "utf8mb4"
	MySQLCollation    = "utf8mb4_bin"

	// JSON 格式化某字段
	ColumnsJSON      = "column"
	IndexJSON        = "index"
	PUConstraintJSON = "puk"
	FKConstraintJSON = "fk"
	CKConstraintJSON = "ck"
	PartitionJSON    = "partition"

	// 默认值规则
	DefaultValueSysdate    = "SYSDATE"
	DefaultValueSysdateMap = "NOW()"
)

Variables

View Source
var CurrentResetFlag = 0

用于控制当程序消费追平到当前 CURRENT 重做日志, 当值 == 0 启用 filterOracleRedoGreaterOrEqualRecordByTable 大于或者等于 当值 == 1 启用 filterOracleRedoGreaterOrEqualRecordByTable 大于,避免已被消费得日志一直被重复消费

Functions

func DiffStructArray

func DiffStructArray(structA, structB interface{}) ([]interface{}, []interface{}, bool)

用于对比 struct 是否相等

func FilterDifferenceStringItems

func FilterDifferenceStringItems(originItems, excludeItems []string) []string

过滤排除元素,返回新数组

func FilterIntersectionStringItems

func FilterIntersectionStringItems(originItems, newItems []string) []string

过滤两个数组相同元素(交集),返回新数组

func GetOutBoundIP added in v1.0.4

func GetOutBoundIP(pprofPort string) (string, error)

获取本机 IP

func GetStringSliceElementIndex

func GetStringSliceElementIndex(items []string, item string) int

获取数组元素下标

func IsContainString

func IsContainString(items []string, item string) bool

数组中是否包含某元素

func IsEmptyString

func IsEmptyString(str string) bool

是否空字符串

func IsNum

func IsNum(s string) bool

判断字符是否是数字

func IsSubsetString

func IsSubsetString(originItems, checkItems []string) (bool, []string)

两个数组对比,判断 checkItems 是否是 originItems 子集

func ReSplit

func ReSplit(text string, cut string) []string

忽略大小写切分字符串

func ReplaceQuotesString

func ReplaceQuotesString(s string) string

替换字符串引号字符

func ReplaceSpecifiedString

func ReplaceSpecifiedString(s string, oldStr, newStr string) string

替换指定字符

func SplitIntSlice

func SplitIntSlice(arr []int, num int64) [][]int

数组拆分

func SplitMultipleSlice added in v1.0.4

func SplitMultipleSlice(arr []interface{}, num int64) [][]interface{}

多重数组拆分

func StrconvFloatBitSize added in v1.0.4

func StrconvFloatBitSize(s string, bitSize int) (float64, error)

func StrconvIntBitSize added in v1.0.4

func StrconvIntBitSize(s string, bitSize int) (int64, error)

字符转换

func StrconvRune added in v1.0.4

func StrconvRune(s string) (int32, error)

func StrconvUintBitSize added in v1.0.4

func StrconvUintBitSize(s string, bitSize int) (uint64, error)

func StringArrayToCapitalChar

func StringArrayToCapitalChar(strs []string) string

字符数组转字符

func StringsBuilder

func StringsBuilder(str ...string) string

字符串拼接

func TrimLastChar

func TrimLastChar(s string) string

删除字符中最后一个字母

func VersionOrdinal

func VersionOrdinal(version string) string

用于版本号比较

Types

This section is empty.

Jump to

Keyboard shortcuts

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