-
Notifications
You must be signed in to change notification settings - Fork 40
/
events.go
54 lines (42 loc) · 2.62 KB
/
events.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package database
import (
"context"
"gorm.io/gorm"
"github.com/bnb-chain/greenfield-storage-provider/store/bsdb"
)
func (db *DB) SaveEventMigrationBucket(ctx context.Context, eventMigrationBucket *bsdb.EventMigrationBucket) (string, []interface{}) {
stat := db.Db.Session(&gorm.Session{DryRun: true}).Table((&bsdb.EventMigrationBucket{}).TableName()).Create(eventMigrationBucket).Statement
return stat.SQL.String(), stat.Vars
}
func (db *DB) SaveEventCompleteMigrationBucket(ctx context.Context, eventCompleteMigrationBucket *bsdb.EventCompleteMigrationBucket) (string, []interface{}) {
stat := db.Db.Session(&gorm.Session{DryRun: true}).Table((&bsdb.EventCompleteMigrationBucket{}).TableName()).Create(eventCompleteMigrationBucket).Statement
return stat.SQL.String(), stat.Vars
}
func (db *DB) SaveEventCancelMigrationBucket(ctx context.Context, eventCancelMigrationBucket *bsdb.EventCancelMigrationBucket) (string, []interface{}) {
stat := db.Db.Session(&gorm.Session{DryRun: true}).Table((&bsdb.EventCancelMigrationBucket{}).TableName()).Create(eventCancelMigrationBucket).Statement
return stat.SQL.String(), stat.Vars
}
func (db *DB) SaveEventSwapOut(ctx context.Context, eventSwapOut *bsdb.EventSwapOut) (string, []interface{}) {
stat := db.Db.Session(&gorm.Session{DryRun: true}).Table((&bsdb.EventSwapOut{}).TableName()).Create(eventSwapOut).Statement
return stat.SQL.String(), stat.Vars
}
func (db *DB) SaveEventCancelSwapOut(ctx context.Context, eventCancelSwapOut *bsdb.EventCancelSwapOut) (string, []interface{}) {
stat := db.Db.Session(&gorm.Session{DryRun: true}).Table((&bsdb.EventCancelSwapOut{}).TableName()).Create(eventCancelSwapOut).Statement
return stat.SQL.String(), stat.Vars
}
func (db *DB) SaveEventCompleteSwapOut(ctx context.Context, eventCompleteSwapOut *bsdb.EventCompleteSwapOut) (string, []interface{}) {
stat := db.Db.Session(&gorm.Session{DryRun: true}).Table((&bsdb.EventCompleteSwapOut{}).TableName()).Create(eventCompleteSwapOut).Statement
return stat.SQL.String(), stat.Vars
}
func (db *DB) SaveEventSPExit(ctx context.Context, eventSPExit *bsdb.EventStorageProviderExit) (string, []interface{}) {
stat := db.Db.Session(&gorm.Session{
DryRun: true,
}).Table((&bsdb.EventStorageProviderExit{}).TableName()).Create(eventSPExit).Statement
return stat.SQL.String(), stat.Vars
}
func (db *DB) SaveEventSPCompleteExit(ctx context.Context, eventSpCompleteExit *bsdb.EventCompleteStorageProviderExit) (string, []interface{}) {
stat := db.Db.Session(&gorm.Session{
DryRun: true,
}).Table((&bsdb.EventCompleteStorageProviderExit{}).TableName()).Create(eventSpCompleteExit).Statement
return stat.SQL.String(), stat.Vars
}