interface.go 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  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. "database/sql"
  7. "reflect"
  8. "time"
  9. "github.com/xormplus/core"
  10. )
  11. // Interface defines the interface which Engine, EngineGroup and Session will implementate.
  12. type Interface interface {
  13. AllCols() *Session
  14. Alias(alias string) *Session
  15. Asc(colNames ...string) *Session
  16. BufferSize(size int) *Session
  17. Cols(columns ...string) *Session
  18. Count(...interface{}) (int64, error)
  19. CreateIndexes(bean interface{}) error
  20. CreateUniques(bean interface{}) error
  21. Decr(column string, arg ...interface{}) *Session
  22. Desc(...string) *Session
  23. Delete(interface{}) (int64, error)
  24. Distinct(columns ...string) *Session
  25. DropIndexes(bean interface{}) error
  26. Exec(string, ...interface{}) (sql.Result, error)
  27. Exist(bean ...interface{}) (bool, error)
  28. Find(interface{}, ...interface{}) error
  29. FindAndCount(interface{}, ...interface{}) (int64, error)
  30. Get(interface{}) (bool, error)
  31. GroupBy(keys string) *Session
  32. ID(interface{}) *Session
  33. In(string, ...interface{}) *Session
  34. Incr(column string, arg ...interface{}) *Session
  35. Insert(...interface{}) (int64, error)
  36. InsertOne(interface{}) (int64, error)
  37. IsTableEmpty(bean interface{}) (bool, error)
  38. IsTableExist(beanOrTableName interface{}) (bool, error)
  39. Iterate(interface{}, IterFunc) error
  40. Limit(int, ...int) *Session
  41. MustCols(columns ...string) *Session
  42. NoAutoCondition(...bool) *Session
  43. NotIn(string, ...interface{}) *Session
  44. Join(joinOperator string, tablename interface{}, condition string, args ...interface{}) *Session
  45. Omit(columns ...string) *Session
  46. OrderBy(order string) *Session
  47. Ping() error
  48. QueryBytes(sqlOrAgrs ...interface{}) (resultsSlice []map[string][]byte, err error)
  49. QueryInterface(sqlorArgs ...interface{}) ([]map[string]interface{}, error)
  50. QueryString(sqlorArgs ...interface{}) ([]map[string]string, error)
  51. QueryValue(sqlorArgs ...interface{}) ([]map[string]Value, error)
  52. QueryResult(sqlorArgs ...interface{}) (result *ResultValue)
  53. Rows(bean interface{}) (*Rows, error)
  54. SetExpr(string, string) *Session
  55. SQL(interface{}, ...interface{}) *Session
  56. Sum(bean interface{}, colName string) (float64, error)
  57. SumInt(bean interface{}, colName string) (int64, error)
  58. Sums(bean interface{}, colNames ...string) ([]float64, error)
  59. SumsInt(bean interface{}, colNames ...string) ([]int64, error)
  60. Table(tableNameOrBean interface{}) *Session
  61. Unscoped() *Session
  62. Update(bean interface{}, condiBeans ...interface{}) (int64, error)
  63. UseBool(...string) *Session
  64. Where(interface{}, ...interface{}) *Session
  65. }
  66. // EngineInterface defines the interface which Engine, EngineGroup will implementate.
  67. type EngineInterface interface {
  68. Interface
  69. Before(func(interface{})) *Session
  70. Charset(charset string) *Session
  71. CreateTables(...interface{}) error
  72. DBMetas() ([]*core.Table, error)
  73. Dialect() core.Dialect
  74. DropTables(...interface{}) error
  75. DumpAllToFile(fp string, tp ...core.DbType) error
  76. GetCacher(string) core.Cacher
  77. GetColumnMapper() core.IMapper
  78. GetDefaultCacher() core.Cacher
  79. GetTableMapper() core.IMapper
  80. GetTZDatabase() *time.Location
  81. GetTZLocation() *time.Location
  82. NewSession() *Session
  83. NoAutoTime() *Session
  84. Quote(string) string
  85. SetCacher(string, core.Cacher)
  86. SetDefaultCacher(core.Cacher)
  87. SetLogLevel(core.LogLevel)
  88. SetMapper(core.IMapper)
  89. SetSchema(string)
  90. SetTZDatabase(tz *time.Location)
  91. SetTZLocation(tz *time.Location)
  92. ShowSQL(show ...bool)
  93. Sync(...interface{}) error
  94. Sync2(...interface{}) error
  95. StoreEngine(storeEngine string) *Session
  96. TableInfo(bean interface{}) *Table
  97. TableName(interface{}, ...bool) string
  98. UnMapType(reflect.Type)
  99. }
  100. var (
  101. _ Interface = &Session{}
  102. _ EngineInterface = &Engine{}
  103. _ EngineInterface = &EngineGroup{}
  104. )