Skip to content

Commit f4a65d9

Browse files
committed
Added an IsDone method for backup
1 parent fd3cd65 commit f4a65d9

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

backup.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,15 @@ type Backup struct {
1313
b *C.sqlite3_backup
1414
}
1515

16+
func IsDone(err error) bool {
17+
sqlErr, ok := err.(Error)
18+
if !ok {
19+
return false
20+
}
21+
22+
return sqlErr.Code == ErrDone
23+
}
24+
1625
func (c *SQLiteConn) Backup(dest string, conn *SQLiteConn, src string) (*Backup, error) {
1726
destptr := C.CString(dest)
1827
defer C.free(unsafe.Pointer(destptr))

error.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ var (
4545
ErrNotADB = ErrNo(26) /* File opened that is not a database file */
4646
ErrNotice = ErrNo(27) /* Notifications from sqlite3_log() */
4747
ErrWarning = ErrNo(28) /* Warnings from sqlite3_log() */
48+
ErrDone = ErrNo(101)
4849
)
4950

5051
func (err ErrNo) Error() string {

0 commit comments

Comments
 (0)