xplus

package
v0.0.0-...-f937022 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Builder

func Builder() *builder.Builder

func Close

func Close()

func Delete

func Delete[T any](q *Query[T]) error

func DeleteById

func DeleteById[T any](id any) (int64, error)

func DeleteByIds

func DeleteByIds[T any](ids any) error

func Engine

func Engine() (*xorm.Engine, error)

func GetById

func GetById[T any](id any) (*T, bool, error)

func Insert

func Insert[T any](obj *T) (int64, error)

func InsertBatch

func InsertBatch[T any](objs ...*T) (int64, error)

func NewEngineWithConfig

func NewEngineWithConfig(cfg *Config) (err error)

func SelectById

func SelectById[T any](id any) (*T, error)

func SelectByIds

func SelectByIds[T any](ids any) ([]*T, error)

func SelectExist

func SelectExist[T any](q *Query[T]) (bool, error)

func SelectList

func SelectList[T any](q *Query[T]) ([]*T, error)

func SelectListModel

func SelectListModel[T any, R any](q *Query[T]) ([]*R, error)

func SelectListModelWithTableName

func SelectListModelWithTableName[T any](tableName string, q *Query[T]) ([]*T, error)

func SelectOne

func SelectOne[T any](q *Query[T]) (*T, error)

func SelectOneModel

func SelectOneModel[T any, R any](q *Query[T]) (*R, error)

func SelectOneModelWithTableName

func SelectOneModelWithTableName[T any](tableName string, q *Query[T]) (*T, error)

func SelectSubExistList

func SelectSubExistList[T any](q *Query[T], f func(sub *Query[T])) ([]*T, error)

func SelectSubExistOne

func SelectSubExistOne[T any](q *Query[T], f func(sub *Query[T])) (*T, error)

func SelectSumInt

func SelectSumInt[T any](q *Query[T], fields string) (int64, error)

func SetLogger

func SetLogger(logger core.ILogger)

func Transaction

func Transaction(f SessionFunc) error

func Update

func Update[T any](obj *T, cols ...string) (int64, error)

func UpdateById

func UpdateById[T any](id any, entity *T) (int64, error)

func UpdateFields

func UpdateFields[T any](q *Query[T], entity *T) (int64, error)

Types

type Config

type Config struct {
	DataSourceName  string
	MaxIdleConns    int
	MaxOpenConns    int
	ConnMaxLifetime time.Duration
	LogLevel        log.LogLevel

	ShowSQL      bool
	ShowExecTime bool
}

type Page

type Page[T any] struct {
	Current   int
	Size      int
	Total     int64
	TotalPage int64
	Records   []*T
}

func SelectPage

func SelectPage[T any](page *Page[T], q *Query[T]) (*Page[T], error)

func SelectPageModel

func SelectPageModel[T any, R any](page *Page[R], q *Query[T]) (*Page[R], error)

func SelectPageModelWithTableName

func SelectPageModelWithTableName[T any](tableName string, page *Page[T], q *Query[T]) (*Page[T], error)

type Query

type Query[T any] struct {
	// contains filtered or unexported fields
}

func NewQuery

func NewQuery[T any]() *Query[T]

func (*Query[T]) Alias

func (q *Query[T]) Alias(alias string) *Query[T]

func (*Query[T]) AllEq

func (q *Query[T]) AllEq(m map[string]interface{}, isAnd ...bool) *Query[T]

func (*Query[T]) And

func (q *Query[T]) And(f func(q *Query[T])) *Query[T]

func (*Query[T]) Between

func (q *Query[T]) Between(column string, start, end interface{}) *Query[T]

func (*Query[T]) Cols

func (q *Query[T]) Cols(columns ...string) *Query[T]

func (*Query[T]) Count

func (q *Query[T]) Count(bean T) (int64, error)

func (*Query[T]) Eq

func (q *Query[T]) Eq(column string, value interface{}) *Query[T]

func (*Query[T]) Exists

func (q *Query[T]) Exists(f func(q *Query[T])) *Query[T]

func (*Query[T]) Find

func (q *Query[T]) Find(beans []*T) ([]*T, error)

func (*Query[T]) Func

func (q *Query[T]) Func(f func(q *Query[T]) *Query[T]) *Query[T]

func (*Query[T]) Ge

func (q *Query[T]) Ge(column string, value interface{}) *Query[T]

func (*Query[T]) Get

func (q *Query[T]) Get(bean *T) (bool, error)

func (*Query[T]) GroupBy

func (q *Query[T]) GroupBy(keys string) *Query[T]

func (*Query[T]) Gt

func (q *Query[T]) Gt(column string, value interface{}) *Query[T]

func (*Query[T]) Having

func (q *Query[T]) Having(condition string) *Query[T]

func (*Query[T]) In

func (q *Query[T]) In(column string, values interface{}) *Query[T]

func (*Query[T]) InBuilder

func (q *Query[T]) InBuilder(column string, builder *builder.Builder) *Query[T]

func (*Query[T]) IsNotNull

func (q *Query[T]) IsNotNull(column string) *Query[T]

func (*Query[T]) IsNull

func (q *Query[T]) IsNull(column string) *Query[T]

func (*Query[T]) Join

func (q *Query[T]) Join(joinType string, tableName interface{}, condition string, args ...interface{}) *Query[T]

func (*Query[T]) Le

func (q *Query[T]) Le(column string, value interface{}) *Query[T]

func (*Query[T]) Like

func (q *Query[T]) Like(column string, value interface{}) *Query[T]

func (*Query[T]) LikeLeft

func (q *Query[T]) LikeLeft(column string, value interface{}) *Query[T]

func (*Query[T]) LikeRight

func (q *Query[T]) LikeRight(column string, value interface{}) *Query[T]

func (*Query[T]) Limit

func (q *Query[T]) Limit(count int) *Query[T]

func (*Query[T]) Lt

func (q *Query[T]) Lt(column string, value interface{}) *Query[T]

func (*Query[T]) Ne

func (q *Query[T]) Ne(column string, value interface{}) *Query[T]

func (*Query[T]) NotBetween

func (q *Query[T]) NotBetween(column string, start, end interface{}) *Query[T]

func (*Query[T]) NotIn

func (q *Query[T]) NotIn(column string, values interface{}) *Query[T]

func (*Query[T]) NotInBuilder

func (q *Query[T]) NotInBuilder(column string, builder *builder.Builder) *Query[T]

func (*Query[T]) NotLike

func (q *Query[T]) NotLike(column string, value interface{}) *Query[T]

func (*Query[T]) NotLikeLeft

func (q *Query[T]) NotLikeLeft(column string, pattern string) *Query[T]

func (*Query[T]) NotLikeRight

func (q *Query[T]) NotLikeRight(column string, pattern string) *Query[T]

func (*Query[T]) Or

func (q *Query[T]) Or(f func(q *Query[T])) *Query[T]

func (*Query[T]) OrderBy

func (q *Query[T]) OrderBy(order string) *Query[T]

func (*Query[T]) Paginate

func (q *Query[T]) Paginate(page, pageSize int) *Query[T]

func (*Query[T]) Select

func (q *Query[T]) Select(columns string) *Query[T]

func (*Query[T]) SetExpr

func (q *Query[T]) SetExpr(column string, expression string) *Query[T]

func (*Query[T]) Skip

func (q *Query[T]) Skip(count int) *Query[T]

func (*Query[T]) Where

func (q *Query[T]) Where(condition string, args ...interface{}) *Query[T]

type SessionFunc

type SessionFunc func(session *xorm.Session) error

Jump to

Keyboard shortcuts

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