interfaces.go 698 B

12345678910111213141516171819202122232425
  1. package gorm
  2. import (
  3. "context"
  4. "database/sql"
  5. "github.com/jinzhu/gorm/schema"
  6. )
  7. // Dialector GORM database dialector
  8. type Dialector interface {
  9. Initialize(*DB) error
  10. Migrator(db *DB) Migrator
  11. DataTypeOf(*schema.Field) string
  12. BindVar(stmt *Statement, v interface{}) string
  13. QuoteChars() [2]byte
  14. }
  15. // CommonDB common db interface
  16. type CommonDB interface {
  17. ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error)
  18. PrepareContext(ctx context.Context, query string) (*sql.Stmt, error)
  19. QueryContext(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error)
  20. QueryRowContext(ctx context.Context, query string, args ...interface{}) *sql.Row
  21. }