forked from schollz/sqlite3dump
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoptions.go
More file actions
27 lines (23 loc) · 747 Bytes
/
options.go
File metadata and controls
27 lines (23 loc) · 747 Bytes
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
package sqlite3dump
// Option is SQL dump option.
type Option func(dumper *sqlite3dumper)
// WithMigration option won't include creation tables and will include table column names.
func WithMigration() Option {
return func(dumper *sqlite3dumper) {
dumper.migration = true
}
}
// WithDropIfExists option drops existing table or index if it already exists.
func WithDropIfExists(dropIfExists bool) Option {
return func(dumper *sqlite3dumper) {
dumper.dropIfExists = dropIfExists
}
}
// WithTransaction wraps query with transaction.
//
// Adds 'BEGIN TRANSACTION' at start and 'COMMIT' at the end.
func WithTransaction(addTransaction bool) Option {
return func(dumper *sqlite3dumper) {
dumper.wrapWithTransaction = addTransaction
}
}