Simple and Powerful ORM for Go, support mysql,postgres,tidb,sqlite3,mssql,oracle https://xorm.io
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.9KB

  1. // Copyright 2017 The Xorm Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. package xorm
  5. import (
  6. "context"
  7. "database/sql"
  8. "reflect"
  9. "time"
  10. "xorm.io/core"
  11. )
  12. // Interface defines the interface which Engine, EngineGroup and Session will implementate.
  13. type Interface interface {
  14. AllCols() *Session
  15. Alias(alias string) *Session
  16. Asc(colNames ...string) *Session
  17. BufferSize(size int) *Session
  18. Cols(columns ...string) *Session
  19. Count(...interface{}) (int64, error)
  20. CreateIndexes(bean interface{}) error
  21. CreateUniques(bean interface{}) error
  22. Decr(column string, arg ...interface{}) *Session
  23. Desc(...string) *Session
  24. Delete(interface{}) (int64, error)
  25. Distinct(columns ...string) *Session
  26. DropIndexes(bean interface{}) error
  27. Exec(sqlOrArgs ...interface{}) (sql.Result, error)
  28. Exist(bean ...interface{}) (bool, error)
  29. Find(interface{}, ...interface{}) error
  30. FindAndCount(interface{}, ...interface{}) (int64, error)
  31. Get(interface{}) (bool, error)
  32. GroupBy(keys string) *Session
  33. ID(interface{}) *Session
  34. In(string, ...interface{}) *Session
  35. Incr(column string, arg ...interface{}) *Session
  36. Insert(...interface{}) (int64, error)
  37. InsertOne(interface{}) (int64, error)
  38. IsTableEmpty(bean interface{}) (bool, error)
  39. IsTableExist(beanOrTableName interface{}) (bool, error)
  40. Iterate(interface{}, IterFunc) error
  41. Limit(int, ...int) *Session
  42. MustCols(columns ...string) *Session
  43. NoAutoCondition(...bool) *Session
  44. NotIn(string, ...interface{}) *Session
  45. Join(joinOperator string, tablename interface{}, condition string, args ...interface{}) *Session
  46. Omit(columns ...string) *Session
  47. OrderBy(order string) *Session
  48. Ping() error
  49. Query(sqlOrArgs ...interface{}) (resultsSlice []map[string][]byte, err error)
  50. QueryInterface(sqlOrArgs ...interface{}) ([]map[string]interface{}, error)
  51. QueryString(sqlOrArgs ...interface{}) ([]map[string]string, error)
  52. Rows(bean interface{}) (*Rows, error)
  53. SetExpr(string, interface{}) *Session
  54. SQL(interface{}, ...interface{}) *Session
  55. Sum(bean interface{}, colName string) (float64, error)
  56. SumInt(bean interface{}, colName string) (int64, error)
  57. Sums(bean interface{}, colNames ...string) ([]float64, error)
  58. SumsInt(bean interface{}, colNames ...string) ([]int64, error)
  59. Table(tableNameOrBean interface{}) *Session
  60. Unscoped() *Session
  61. Update(bean interface{}, condiBeans ...interface{}) (int64, error)
  62. UseBool(...string) *Session
  63. Where(interface{}, ...interface{}) *Session
  64. }
  65. // EngineInterface defines the interface which Engine, EngineGroup will implementate.
  66. type EngineInterface interface {
  67. Interface
  68. Before(func(interface{})) *Session
  69. Charset(charset string) *Session
  70. ClearCache(...interface{}) error
  71. Context(context.Context) *Session
  72. CreateTables(...interface{}) error
  73. DBMetas() ([]*core.Table, error)
  74. Dialect() core.Dialect
  75. DropTables(...interface{}) error
  76. DumpAllToFile(fp string, tp ...core.DbType) error
  77. GetCacher(string) core.Cacher
  78. GetColumnMapper() core.IMapper
  79. GetDefaultCacher() core.Cacher
  80. GetTableMapper() core.IMapper
  81. GetTZDatabase() *time.Location
  82. GetTZLocation() *time.Location
  83. MapCacher(interface{}, core.Cacher) error
  84. NewSession() *Session
  85. NoAutoTime() *Session
  86. Quote(string) string
  87. SetCacher(string, core.Cacher)
  88. SetConnMaxLifetime(time.Duration)
  89. SetDefaultCacher(core.Cacher)
  90. SetLogger(logger core.ILogger)
  91. SetLogLevel(core.LogLevel)
  92. SetMapper(core.IMapper)
  93. SetMaxOpenConns(int)
  94. SetMaxIdleConns(int)
  95. SetSchema(string)
  96. SetTZDatabase(tz *time.Location)
  97. SetTZLocation(tz *time.Location)
  98. ShowExecTime(...bool)
  99. ShowSQL(show ...bool)
  100. Sync(...interface{}) error
  101. Sync2(...interface{}) error
  102. StoreEngine(storeEngine string) *Session
  103. TableInfo(bean interface{}) *Table
  104. TableName(interface{}, ...bool) string
  105. UnMapType(reflect.Type)
  106. }
  107. var (
  108. _ Interface = &Session{}
  109. _ EngineInterface = &Engine{}
  110. _ EngineInterface = &EngineGroup{}
  111. )