dialect

package
v5.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2024 License: MIT Imports: 11 Imported by: 3

Documentation

Overview

Package dialect 提供了部分数据库对 orm.Dialect 接口的实现

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Mariadb

func Mariadb(driverName string) core.Dialect

Mariadb 返回一个适配 mariadb 的 Dialect 接口

options 属性可参考 mysql,大部分内容与 Mysql 相同。

func Mysql

func Mysql(driverName string) core.Dialect

Mysql 返回一个适配 mysql 的 Dialect 接口

支持以下 options 属性

mysql_charset 字符集,语法为: charset(utf-8)
mysql_engine 使用的引擎,语法为: engine(innodb)

func Postgres

func Postgres(driverName string) core.Dialect

Postgres 返回一个适配 postgresql 的 Dialect 接口

func PrepareNamedArgs

func PrepareNamedArgs(query string) (string, map[string]int, error)

PrepareNamedArgs 对命名参数进行预处理

命名参数替换成 ?,并返回参数名称对应在语句的位置。 query 中不能同时包含命名参数和 ?,否则将 panic。

func Sqlite3

func Sqlite3(driverName string) core.Dialect

Sqlite3 返回一个适配 sqlite3 的 Dialect 接口

Options 可以接受以下参数:

  • rowid 可以是 rowid(false);rowid(true),rowid,其中只有 rowid(false) 等同于 without rowid

Types

This section is empty.

Jump to

Keyboard shortcuts

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