sqlbuilder

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SqlTagDefault = "sql"
)

Tag prefixes

Variables

This section is empty.

Functions

This section is empty.

Types

type SqlBuilder

type SqlBuilder struct {
	// contains filtered or unexported fields
}

SqlBuilder ...

func NewSqlBuilder

func NewSqlBuilder(opts ...SqlBuilderOption) *SqlBuilder

NewSqlBuilder ...

func (SqlBuilder) AddTable

func (s SqlBuilder) AddTable(obj interface{}) string

AddTable ...

func (SqlBuilder) GetTableName

func (s SqlBuilder) GetTableName(t interface{}) (string, string)

GetTableName read from TableNameFn or parse table name from model as snake_case return object name and table name

func (*SqlBuilder) MappingTables

func (s *SqlBuilder) MappingTables(m map[string]string)

MappingTables ...

func (SqlBuilder) RemoveTable

func (s SqlBuilder) RemoveTable(tb interface{}) string

RemoveTable ...

type SqlBuilderOption

type SqlBuilderOption interface {
	// contains filtered or unexported methods
}

SqlBuilderOption ...

func WithCommentGenerate

func WithCommentGenerate() SqlBuilderOption

WithCommentGenerate default is off

func WithDialect

func WithDialect(dialect sqltemplates.SqlDialect) SqlBuilderOption

WithDialect ...

func WithMysql

func WithMysql() SqlBuilderOption

WithMysql default

func WithPluralTableName

func WithPluralTableName() SqlBuilderOption

WithPluralTableName Table name in plural convention - ending with `s`

func WithPostgresql

func WithPostgresql() SqlBuilderOption

WithPostgresql ...

func WithSqlLowercase

func WithSqlLowercase() SqlBuilderOption

WithSqlLowercase ...

func WithSqlTag

func WithSqlTag(sqlTag string) SqlBuilderOption

WithSqlTag default tag is `sql`

func WithSqlUppercase

func WithSqlUppercase() SqlBuilderOption

WithSqlUppercase default

func WithSqlite

func WithSqlite() SqlBuilderOption

WithSqlite ...

func WithSqlserver

func WithSqlserver() SqlBuilderOption

WithSqlserver ...

Jump to

Keyboard shortcuts

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