nsql

package
v0.6.11 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2024 License: AGPL-3.0 Imports: 17 Imported by: 12

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SQLKeyReplacer = strings.NewReplacer("`", "``", ".", "`.`")

Functions

func ModelObjects

func ModelObjects(m factory.Model) []interface{}

func ParseMysqlConnectionURL

func ParseMysqlConnectionURL(settings *mysql.ConnectionURL)

func ParseSQL

func ParseSQL(sqlFile string, isFile bool, installer func(string) error) (err error)

func ReplaceCharset

func ReplaceCharset(sqlStr string, charset string, checkCreateDDL ...bool) string

ReplaceCharset 替换DDL语句中的字符集

func ReplacePrefix

func ReplacePrefix(m factory.Model, field string, oldPrefix string, newPrefix string) error

ReplacePrefix 替换前缀数据

func SQLLineParser

func SQLLineParser(exec func(string) error, useCommentSQL ...bool) func(string) error

Types

type SQLQuery

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

func NewSQLQuery

func NewSQLQuery(ctx echo.Context) *SQLQuery

func NewSQLQueryLimit

func NewSQLQueryLimit(ctx echo.Context, offset int, limit int, linkIDs ...int) *SQLQuery

func (*SQLQuery) CacheKey

func (s *SQLQuery) CacheKey(cacheKey string) *SQLQuery

func (*SQLQuery) CacheTTL

func (s *SQLQuery) CacheTTL(ttlSeconds int64) *SQLQuery

func (*SQLQuery) GetFloat64

func (s *SQLQuery) GetFloat64(query string, args ...interface{}) (null.Float64, error)

func (*SQLQuery) GetInt

func (s *SQLQuery) GetInt(query string, args ...interface{}) (null.Int, error)

func (*SQLQuery) GetInt32

func (s *SQLQuery) GetInt32(query string, args ...interface{}) (null.Int32, error)

func (*SQLQuery) GetInt64

func (s *SQLQuery) GetInt64(query string, args ...interface{}) (null.Int64, error)

func (*SQLQuery) GetModel

func (s *SQLQuery) GetModel(name string, args ...interface{}) (interface{}, error)

func (*SQLQuery) GetModels

func (s *SQLQuery) GetModels(name string, args ...interface{}) ([]interface{}, error)

func (*SQLQuery) GetModelsWithPaging

func (s *SQLQuery) GetModelsWithPaging(name string, args ...interface{}) ([]interface{}, error)

func (*SQLQuery) GetRow

func (s *SQLQuery) GetRow(query string, args ...interface{}) (null.StringMap, error)

GetRow 查询一行多个字段值

func (*SQLQuery) GetRows

func (s *SQLQuery) GetRows(query string, args ...interface{}) (null.StringMapSlice, error)

GetRows 查询多行

func (*SQLQuery) GetString

func (s *SQLQuery) GetString(query string, args ...interface{}) (null.String, error)

func (*SQLQuery) GetUint

func (s *SQLQuery) GetUint(query string, args ...interface{}) (null.Uint, error)

func (*SQLQuery) GetUint32

func (s *SQLQuery) GetUint32(query string, args ...interface{}) (null.Uint32, error)

func (*SQLQuery) GetUint64

func (s *SQLQuery) GetUint64(query string, args ...interface{}) (null.Uint64, error)

func (*SQLQuery) GetValue

func (s *SQLQuery) GetValue(recv interface{}, query string, args ...interface{}) error

GetValue 查询单个字段值

func (*SQLQuery) Limit

func (s *SQLQuery) Limit(limit int) *SQLQuery

func (*SQLQuery) LinkID

func (s *SQLQuery) LinkID(dbLinkID int) *SQLQuery

func (*SQLQuery) LinkName

func (s *SQLQuery) LinkName(dbLinkName string) *SQLQuery

func (*SQLQuery) MustGetFloat64

func (s *SQLQuery) MustGetFloat64(query string, args ...interface{}) null.Float64

func (*SQLQuery) MustGetInt

func (s *SQLQuery) MustGetInt(query string, args ...interface{}) null.Int

func (*SQLQuery) MustGetInt32

func (s *SQLQuery) MustGetInt32(query string, args ...interface{}) null.Int32

func (*SQLQuery) MustGetInt64

func (s *SQLQuery) MustGetInt64(query string, args ...interface{}) null.Int64

func (*SQLQuery) MustGetModel

func (s *SQLQuery) MustGetModel(structName string, args ...interface{}) interface{}

func (*SQLQuery) MustGetModels

func (s *SQLQuery) MustGetModels(structName string, args ...interface{}) []interface{}

func (*SQLQuery) MustGetModelsWithPaging

func (s *SQLQuery) MustGetModelsWithPaging(structName string, args ...interface{}) []interface{}

func (*SQLQuery) MustGetRow

func (s *SQLQuery) MustGetRow(query string, args ...interface{}) null.StringMap

func (*SQLQuery) MustGetRows

func (s *SQLQuery) MustGetRows(query string, args ...interface{}) null.StringMapSlice

func (*SQLQuery) MustGetString

func (s *SQLQuery) MustGetString(query string, args ...interface{}) null.String

func (*SQLQuery) MustGetUint

func (s *SQLQuery) MustGetUint(query string, args ...interface{}) null.Uint

func (*SQLQuery) MustGetUint32

func (s *SQLQuery) MustGetUint32(query string, args ...interface{}) null.Uint32

func (*SQLQuery) MustGetUint64

func (s *SQLQuery) MustGetUint64(query string, args ...interface{}) null.Uint64

func (*SQLQuery) Offset

func (s *SQLQuery) Offset(offset int) *SQLQuery

func (*SQLQuery) OrderBy

func (s *SQLQuery) OrderBy(sorts ...interface{}) *SQLQuery

type SelectPageSortValues

type SelectPageSortValues struct {
	PKName   string
	PKValues []string
}

func SelectPageCond

func SelectPageCond(ctx echo.Context, cond *db.Compounds, pkAndLabelFields ...string) (sv *SelectPageSortValues)

func (SelectPageSortValues) AddToSorts

func (s SelectPageSortValues) AddToSorts(sorts []interface{}) []interface{}

func (SelectPageSortValues) IsEmpty

func (s SelectPageSortValues) IsEmpty() bool

func (SelectPageSortValues) IsMultiple

func (s SelectPageSortValues) IsMultiple() bool

func (SelectPageSortValues) OrderByString

func (s SelectPageSortValues) OrderByString() string

type SetContext

type SetContext interface {
	SetContext(echo.Context)
}

Jump to

Keyboard shortcuts

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