utils

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2025 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package utils contains some common utilities used by all other packages.

Index

Constants

View Source
const (
	PrimaryKeySeparator = "-#-" // used to hash a composite primary key
)

Variables

This section is empty.

Functions

func EscapeMySQLType

func EscapeMySQLType(columnType string, value any) string

EscapeMySQLType formats a Go value for use in SQL VALUES clause using proper SQL escaping It takes into account the MySQL column type to handle escaping appropriately

func HashKey

func HashKey(key []any) string

HashKey is used to convert a composite key into a string so that it can be placed in a map.

func IntersectNonGeneratedColumns

func IntersectNonGeneratedColumns(t1, t2 *table.TableInfo) string

IntersectNonGeneratedColumns returns a string of columns that are in both tables The column names are in backticks and comma separated.

func IntersectNonGeneratedColumnsAsSlice

func IntersectNonGeneratedColumnsAsSlice(t1, t2 *table.TableInfo) []string

IntersectNonGeneratedColumnsAsSlice returns a slice of column names that are in both tables

func StripPort

func StripPort(hostname string) string

func UnhashKey

func UnhashKey(key string) []string

UnhashKey converts a hashed key to a []string

func UnhashKeyToString

func UnhashKeyToString(key string) string

UnhashKeyToString converts a hashed key to a string that can be used in a query.

Types

This section is empty.

Jump to

Keyboard shortcuts

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