mdbc/drop.go

26 lines
423 B
Go

package mdbc
import "context"
type dropScope struct {
scope *scope
mdbc *mdbc
ctx context.Context
}
func (ds *dropScope) SetContext(ctx context.Context) *dropScope {
ds.ctx = ctx
return ds
}
func (ds *dropScope) mergeOptions() {
if ds.ctx == nil {
ds.ctx = context.Background()
}
}
func (ds *dropScope) Do() error {
ds.mergeOptions()
return ds.mdbc.database.Collection(ds.scope.tableName).Drop(ds.ctx)
}