mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
Implementing batch deletes for calls, logs and routes
Partially-Closes: #302
This commit is contained in:
@@ -621,6 +621,24 @@ func (ds *sqlStore) DeleteLog(ctx context.Context, appName, callID string) error
|
||||
return err
|
||||
}
|
||||
|
||||
func (ds *sqlStore) BatchDeleteLogs(ctx context.Context, appName string) error {
|
||||
query := ds.db.Rebind(`DELETE FROM logs WHERE app_name=?`)
|
||||
_, err := ds.db.ExecContext(ctx, query, appName)
|
||||
return err
|
||||
}
|
||||
|
||||
func (ds *sqlStore) BatchDeleteCalls(ctx context.Context, appName string) error {
|
||||
query := ds.db.Rebind(`DELETE FROM calls WHERE app_name=?`)
|
||||
_, err := ds.db.ExecContext(ctx, query, appName)
|
||||
return err
|
||||
}
|
||||
|
||||
func (ds *sqlStore) BatchDeleteRoutes(ctx context.Context, appName string) error {
|
||||
query := ds.db.Rebind(`DELETE FROM routes WHERE app_name=?`)
|
||||
_, err := ds.db.ExecContext(ctx, query, appName)
|
||||
return err
|
||||
}
|
||||
|
||||
// TODO scrap for sqlx scanx ?? some things aren't perfect (e.g. config is a json string)
|
||||
type RowScanner interface {
|
||||
Scan(dest ...interface{}) error
|
||||
|
||||
Reference in New Issue
Block a user