You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
119 lines
3.9 KiB
119 lines
3.9 KiB
7 years ago
|
// Copyright 2017 The Xorm Authors. All rights reserved.
|
||
|
// Use of this source code is governed by a BSD-style
|
||
|
// license that can be found in the LICENSE file.
|
||
|
|
||
|
package xorm
|
||
|
|
||
|
import (
|
||
6 years ago
|
"context"
|
||
7 years ago
|
"database/sql"
|
||
|
"reflect"
|
||
|
"time"
|
||
|
|
||
6 years ago
|
"xorm.io/core"
|
||
7 years ago
|
)
|
||
|
|
||
|
// Interface defines the interface which Engine, EngineGroup and Session will implementate.
|
||
|
type Interface interface {
|
||
|
AllCols() *Session
|
||
|
Alias(alias string) *Session
|
||
|
Asc(colNames ...string) *Session
|
||
|
BufferSize(size int) *Session
|
||
|
Cols(columns ...string) *Session
|
||
|
Count(...interface{}) (int64, error)
|
||
|
CreateIndexes(bean interface{}) error
|
||
|
CreateUniques(bean interface{}) error
|
||
|
Decr(column string, arg ...interface{}) *Session
|
||
|
Desc(...string) *Session
|
||
|
Delete(interface{}) (int64, error)
|
||
|
Distinct(columns ...string) *Session
|
||
|
DropIndexes(bean interface{}) error
|
||
6 years ago
|
Exec(sqlOrArgs ...interface{}) (sql.Result, error)
|
||
7 years ago
|
Exist(bean ...interface{}) (bool, error)
|
||
|
Find(interface{}, ...interface{}) error
|
||
6 years ago
|
FindAndCount(interface{}, ...interface{}) (int64, error)
|
||
7 years ago
|
Get(interface{}) (bool, error)
|
||
|
GroupBy(keys string) *Session
|
||
|
ID(interface{}) *Session
|
||
|
In(string, ...interface{}) *Session
|
||
|
Incr(column string, arg ...interface{}) *Session
|
||
|
Insert(...interface{}) (int64, error)
|
||
|
InsertOne(interface{}) (int64, error)
|
||
|
IsTableEmpty(bean interface{}) (bool, error)
|
||
|
IsTableExist(beanOrTableName interface{}) (bool, error)
|
||
|
Iterate(interface{}, IterFunc) error
|
||
|
Limit(int, ...int) *Session
|
||
6 years ago
|
MustCols(columns ...string) *Session
|
||
7 years ago
|
NoAutoCondition(...bool) *Session
|
||
|
NotIn(string, ...interface{}) *Session
|
||
|
Join(joinOperator string, tablename interface{}, condition string, args ...interface{}) *Session
|
||
|
Omit(columns ...string) *Session
|
||
|
OrderBy(order string) *Session
|
||
|
Ping() error
|
||
6 years ago
|
Query(sqlOrArgs ...interface{}) (resultsSlice []map[string][]byte, err error)
|
||
|
QueryInterface(sqlOrArgs ...interface{}) ([]map[string]interface{}, error)
|
||
|
QueryString(sqlOrArgs ...interface{}) ([]map[string]string, error)
|
||
7 years ago
|
Rows(bean interface{}) (*Rows, error)
|
||
5 years ago
|
SetExpr(string, interface{}) *Session
|
||
7 years ago
|
SQL(interface{}, ...interface{}) *Session
|
||
|
Sum(bean interface{}, colName string) (float64, error)
|
||
|
SumInt(bean interface{}, colName string) (int64, error)
|
||
|
Sums(bean interface{}, colNames ...string) ([]float64, error)
|
||
|
SumsInt(bean interface{}, colNames ...string) ([]int64, error)
|
||
|
Table(tableNameOrBean interface{}) *Session
|
||
|
Unscoped() *Session
|
||
|
Update(bean interface{}, condiBeans ...interface{}) (int64, error)
|
||
|
UseBool(...string) *Session
|
||
|
Where(interface{}, ...interface{}) *Session
|
||
|
}
|
||
|
|
||
|
// EngineInterface defines the interface which Engine, EngineGroup will implementate.
|
||
|
type EngineInterface interface {
|
||
|
Interface
|
||
|
|
||
|
Before(func(interface{})) *Session
|
||
|
Charset(charset string) *Session
|
||
6 years ago
|
ClearCache(...interface{}) error
|
||
6 years ago
|
Context(context.Context) *Session
|
||
7 years ago
|
CreateTables(...interface{}) error
|
||
|
DBMetas() ([]*core.Table, error)
|
||
|
Dialect() core.Dialect
|
||
|
DropTables(...interface{}) error
|
||
|
DumpAllToFile(fp string, tp ...core.DbType) error
|
||
6 years ago
|
GetCacher(string) core.Cacher
|
||
7 years ago
|
GetColumnMapper() core.IMapper
|
||
|
GetDefaultCacher() core.Cacher
|
||
|
GetTableMapper() core.IMapper
|
||
|
GetTZDatabase() *time.Location
|
||
|
GetTZLocation() *time.Location
|
||
6 years ago
|
MapCacher(interface{}, core.Cacher) error
|
||
7 years ago
|
NewSession() *Session
|
||
|
NoAutoTime() *Session
|
||
|
Quote(string) string
|
||
6 years ago
|
SetCacher(string, core.Cacher)
|
||
6 years ago
|
SetConnMaxLifetime(time.Duration)
|
||
7 years ago
|
SetDefaultCacher(core.Cacher)
|
||
6 years ago
|
SetLogger(logger core.ILogger)
|
||
7 years ago
|
SetLogLevel(core.LogLevel)
|
||
|
SetMapper(core.IMapper)
|
||
6 years ago
|
SetMaxOpenConns(int)
|
||
|
SetMaxIdleConns(int)
|
||
6 years ago
|
SetSchema(string)
|
||
7 years ago
|
SetTZDatabase(tz *time.Location)
|
||
|
SetTZLocation(tz *time.Location)
|
||
6 years ago
|
ShowExecTime(...bool)
|
||
7 years ago
|
ShowSQL(show ...bool)
|
||
|
Sync(...interface{}) error
|
||
|
Sync2(...interface{}) error
|
||
|
StoreEngine(storeEngine string) *Session
|
||
|
TableInfo(bean interface{}) *Table
|
||
6 years ago
|
TableName(interface{}, ...bool) string
|
||
7 years ago
|
UnMapType(reflect.Type)
|
||
|
}
|
||
|
|
||
|
var (
|
||
|
_ Interface = &Session{}
|
||
|
_ EngineInterface = &Engine{}
|
||
|
_ EngineInterface = &EngineGroup{}
|
||
|
)
|