You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

interface.go 4.2 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  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/xorm/caches"
  11. "xorm.io/xorm/dialects"
  12. "xorm.io/xorm/log"
  13. "xorm.io/xorm/names"
  14. "xorm.io/xorm/schemas"
  15. )
  16. // Interface defines the interface which Engine, EngineGroup and Session will implementate.
  17. type Interface interface {
  18. AllCols() *Session
  19. Alias(alias string) *Session
  20. Asc(colNames ...string) *Session
  21. BufferSize(size int) *Session
  22. Cols(columns ...string) *Session
  23. Count(...interface{}) (int64, error)
  24. CreateIndexes(bean interface{}) error
  25. CreateUniques(bean interface{}) error
  26. Decr(column string, arg ...interface{}) *Session
  27. Desc(...string) *Session
  28. Delete(interface{}) (int64, error)
  29. Distinct(columns ...string) *Session
  30. DropIndexes(bean interface{}) error
  31. Exec(sqlOrArgs ...interface{}) (sql.Result, error)
  32. Exist(bean ...interface{}) (bool, error)
  33. Find(interface{}, ...interface{}) error
  34. FindAndCount(interface{}, ...interface{}) (int64, error)
  35. Get(interface{}) (bool, error)
  36. GroupBy(keys string) *Session
  37. ID(interface{}) *Session
  38. In(string, ...interface{}) *Session
  39. Incr(column string, arg ...interface{}) *Session
  40. Insert(...interface{}) (int64, error)
  41. InsertOne(interface{}) (int64, error)
  42. IsTableEmpty(bean interface{}) (bool, error)
  43. IsTableExist(beanOrTableName interface{}) (bool, error)
  44. Iterate(interface{}, IterFunc) error
  45. Limit(int, ...int) *Session
  46. MustCols(columns ...string) *Session
  47. NoAutoCondition(...bool) *Session
  48. NotIn(string, ...interface{}) *Session
  49. Join(joinOperator string, tablename interface{}, condition string, args ...interface{}) *Session
  50. Omit(columns ...string) *Session
  51. OrderBy(order string) *Session
  52. Ping() error
  53. Query(sqlOrArgs ...interface{}) (resultsSlice []map[string][]byte, err error)
  54. QueryInterface(sqlOrArgs ...interface{}) ([]map[string]interface{}, error)
  55. QueryString(sqlOrArgs ...interface{}) ([]map[string]string, error)
  56. Rows(bean interface{}) (*Rows, error)
  57. SetExpr(string, interface{}) *Session
  58. Select(string) *Session
  59. SQL(interface{}, ...interface{}) *Session
  60. Sum(bean interface{}, colName string) (float64, error)
  61. SumInt(bean interface{}, colName string) (int64, error)
  62. Sums(bean interface{}, colNames ...string) ([]float64, error)
  63. SumsInt(bean interface{}, colNames ...string) ([]int64, error)
  64. Table(tableNameOrBean interface{}) *Session
  65. Unscoped() *Session
  66. Update(bean interface{}, condiBeans ...interface{}) (int64, error)
  67. UseBool(...string) *Session
  68. Where(interface{}, ...interface{}) *Session
  69. }
  70. // EngineInterface defines the interface which Engine, EngineGroup will implementate.
  71. type EngineInterface interface {
  72. Interface
  73. Before(func(interface{})) *Session
  74. Charset(charset string) *Session
  75. ClearCache(...interface{}) error
  76. Context(context.Context) *Session
  77. CreateTables(...interface{}) error
  78. DBMetas() ([]*schemas.Table, error)
  79. Dialect() dialects.Dialect
  80. DriverName() string
  81. DropTables(...interface{}) error
  82. DumpAllToFile(fp string, tp ...schemas.DBType) error
  83. GetCacher(string) caches.Cacher
  84. GetColumnMapper() names.Mapper
  85. GetDefaultCacher() caches.Cacher
  86. GetTableMapper() names.Mapper
  87. GetTZDatabase() *time.Location
  88. GetTZLocation() *time.Location
  89. ImportFile(fp string) ([]sql.Result, error)
  90. MapCacher(interface{}, caches.Cacher) error
  91. NewSession() *Session
  92. NoAutoTime() *Session
  93. Quote(string) string
  94. SetCacher(string, caches.Cacher)
  95. SetConnMaxLifetime(time.Duration)
  96. SetColumnMapper(names.Mapper)
  97. SetDefaultCacher(caches.Cacher)
  98. SetLogger(logger interface{})
  99. SetLogLevel(log.LogLevel)
  100. SetMapper(names.Mapper)
  101. SetMaxOpenConns(int)
  102. SetMaxIdleConns(int)
  103. SetQuotePolicy(dialects.QuotePolicy)
  104. SetSchema(string)
  105. SetTableMapper(names.Mapper)
  106. SetTZDatabase(tz *time.Location)
  107. SetTZLocation(tz *time.Location)
  108. ShowSQL(show ...bool)
  109. Sync(...interface{}) error
  110. Sync2(...interface{}) error
  111. StoreEngine(storeEngine string) *Session
  112. TableInfo(bean interface{}) (*schemas.Table, error)
  113. TableName(interface{}, ...bool) string
  114. UnMapType(reflect.Type)
  115. }
  116. var (
  117. _ Interface = &Session{}
  118. _ EngineInterface = &Engine{}
  119. _ EngineInterface = &EngineGroup{}
  120. )