Skip to content

Commit

Permalink
cloudcommon: expose ITableSpec function
Browse files Browse the repository at this point in the history
  • Loading branch information
zexi committed Jun 9, 2020
1 parent 734d7e9 commit 10603b4
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions pkg/cloudcommon/db/tablespec.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,22 @@ import (

type ITableSpec interface {
Name() string
Columns() []sqlchemy.IColumnSpec
PrimaryColumns() []sqlchemy.IColumnSpec
DataType() reflect.Type
CreateSQL() string
Instance() *sqlchemy.STable
ColumnSpec(name string) sqlchemy.IColumnSpec
Insert(ctx context.Context, dt interface{}) error
InsertOrUpdate(ctx context.Context, dt interface{}) error
Update(ctx context.Context, dt interface{}, doUpdate func() error) (sqlchemy.UpdateDiffs, error)
Instance() *sqlchemy.STable
ColumnSpec(name string) sqlchemy.IColumnSpec
PrimaryColumns() []sqlchemy.IColumnSpec
Columns() []sqlchemy.IColumnSpec
Fetch(dt interface{}) error
FetchAll(dest interface{}) error
SyncSQL() []string
DropForeignKeySQL() []string
AddIndex(unique bool, cols ...string) bool
Increment(diff interface{}, target interface{}) error
Decrement(diff interface{}, target interface{}) error
}

type sTableSpec struct {
Expand Down

0 comments on commit 10603b4

Please sign in to comment.