dialect

package
v0.8.2 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package dialect 定义 SQL 方言。 Go 没有枚举,用「具名字符串类型 + 常量」表达,避免裸 string 满天飞且类型不安全。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SqlDialect

type SqlDialect string

SqlDialect 是底层类型为 string 的「具名类型」(named type,非 type alias:用 type X string 而非 type X = string)。用具名类型而非裸 string 可获得编译期类型安全。

const (
	// MySQL 表示 MySQL 数据库方言。
	MySQL SqlDialect = "mysql"
	// PostgreSQL 表示 PostgreSQL 数据库方言。
	PostgreSQL SqlDialect = "postgresql"
)

func FromValue

func FromValue(s string) (SqlDialect, error)

FromValue 解析配置字符串为方言,未知值报错。 对应 Java 的 SqlDialect.fromValue 静态工厂方法。

Jump to

Keyboard shortcuts

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