Skip to content
This repository was archived by the owner on Mar 27, 2024. It is now read-only.

Commit 595840f

Browse files
committed
feat: Adding sqlite to mobile
Signed-off-by: Ana Maria Franco <[email protected]>
1 parent 2aee6d4 commit 595840f

File tree

8 files changed

+1232
-7
lines changed

8 files changed

+1232
-7
lines changed

Diff for: cmd/aries-agent-mobile/go.mod

+5-2
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,16 @@ require (
1717
nhooyr.io/websocket v1.8.3
1818
)
1919

20+
require github.com/kr/pretty v0.2.1 // indirect
21+
2022
require (
2123
github.com/PaesslerAG/gval v1.1.0 // indirect
2224
github.com/PaesslerAG/jsonpath v0.1.1 // indirect
2325
github.com/VictoriaMetrics/fastcache v1.5.7 // indirect
2426
github.com/bluele/gcache v0.0.0-20190518031135-bc40bd653833 // indirect
2527
github.com/btcsuite/btcd v0.22.0-beta // indirect
2628
github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce // indirect
27-
github.com/cenkalti/backoff/v4 v4.0.2 // indirect
29+
github.com/cenkalti/backoff/v4 v4.1.3 // indirect
2830
github.com/cespare/xxhash/v2 v2.1.1 // indirect
2931
github.com/davecgh/go-spew v1.1.1 // indirect
3032
github.com/golang/protobuf v1.5.2 // indirect
@@ -36,9 +38,10 @@ require (
3638
github.com/kawamuray/jsonpath v0.0.0-20201211160320-7483bafabd7e // indirect
3739
github.com/kilic/bls12-381 v0.1.1-0.20210503002446-7b7597926c69 // indirect
3840
github.com/klauspost/compress v1.10.0 // indirect
41+
github.com/mattn/go-sqlite3 v1.14.14
3942
github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 // indirect
4043
github.com/minio/sha256-simd v0.1.1 // indirect
41-
github.com/mitchellh/mapstructure v1.1.2 // indirect
44+
github.com/mitchellh/mapstructure v1.4.1 // indirect
4245
github.com/mr-tron/base58 v1.2.0 // indirect
4346
github.com/multiformats/go-base32 v0.0.4 // indirect
4447
github.com/multiformats/go-base36 v0.1.0 // indirect

Diff for: cmd/aries-agent-mobile/go.sum

+8-3
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,9 @@ github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku
6464
github.com/btcsuite/snappy-go v1.0.0/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc=
6565
github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY=
6666
github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs=
67-
github.com/cenkalti/backoff/v4 v4.0.2 h1:JIufpQLbh4DkbQoii76ItQIUFzevQSqOLZca4eamEDs=
6867
github.com/cenkalti/backoff/v4 v4.0.2/go.mod h1:eEew/i+1Q6OrCDZh3WiXYv3+nJwBASZ8Bog/87DQnVg=
68+
github.com/cenkalti/backoff/v4 v4.1.3 h1:cFAlzYUlVYDysBEH2T5hyJZMh3+5+WCBvSnK6Q8UtC4=
69+
github.com/cenkalti/backoff/v4 v4.1.3/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw=
6970
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
7071
github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY=
7172
github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
@@ -209,13 +210,16 @@ github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+o
209210
github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4=
210211
github.com/klauspost/compress v1.10.0 h1:92XGj1AcYzA6UrVdd4qIIBrT8OroryvRvdmg/IfmC7Y=
211212
github.com/klauspost/compress v1.10.0/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs=
212-
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
213213
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
214+
github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI=
215+
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
214216
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
215217
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
216218
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
217219
github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
218220
github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
221+
github.com/mattn/go-sqlite3 v1.14.14 h1:qZgc/Rwetq+MtyE18WhzjokPD93dNqLGNT3QJuLvBGw=
222+
github.com/mattn/go-sqlite3 v1.14.14/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU=
219223
github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 h1:lYpkrQH5ajf0OXOcUbGjvZxxijuBwbbmlSxLiuofa+g=
220224
github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1/go.mod h1:pD8RvIylQ358TN4wwqatJ8rNavkEINozVn9DtGI3dfQ=
221225
github.com/minio/sha256-simd v0.1.1-0.20190913151208-6de447530771/go.mod h1:B5e1o+1/KgNmWrSQK08Y6Z1Vb5pwIktudl0J58iy0KM=
@@ -227,8 +231,9 @@ github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrk
227231
github.com/mitchellh/go-testing-interface v0.0.0-20171004221916-a61a99592b77/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI=
228232
github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI=
229233
github.com/mitchellh/go-wordwrap v1.0.0/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo=
230-
github.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE=
231234
github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
235+
github.com/mitchellh/mapstructure v1.4.1 h1:CpVNEelQCZBooIPDn+AR3NpivK/TIKU8bDxdASFVQag=
236+
github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
232237
github.com/mitchellh/reflectwalk v1.0.0/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw=
233238
github.com/mr-tron/base58 v1.1.0/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8=
234239
github.com/mr-tron/base58 v1.1.3/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc=

Diff for: cmd/aries-agent-mobile/pkg/api/storage.go

+7
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,13 @@ type Iterator interface {
112112
// aries-framework-go/spi/storage/Tag.
113113
Tags() ([]byte, error)
114114

115+
// TotalItems returns a count of the number of entries (key + value + tags triplets) matched by the query
116+
// that generated this Iterator. This count is not affected by the page settings used (i.e. the count is of all
117+
// results as if you queried starting from the first page and with an unlimited page size).
118+
// Depending on the storage implementation, you may need to ensure that the TagName used in the query is in the
119+
// Store's StoreConfiguration before trying to call this method (or it may be optional, but recommended).
120+
TotalItems() (int, error)
121+
115122
// Close closes this iterator object, freeing resources.
116123
Close() error
117124
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*
2+
Copyright SecureKey Technologies Inc. All Rights Reserved.
3+
4+
SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
package sqlite
8+
9+
import (
10+
"errors"
11+
)
12+
13+
const (
14+
// Error messages we return.
15+
failureWhileOpeningSQLiteConnectionErrMsg = "failure while opening SQLite connection using path %s: %w"
16+
failureWhileClosingSQLiteConnection = "failure while closing SQLite DB connection: %w"
17+
failureWhilePingingSQLiteErrMsg = "failure while pinging SQLite at path %s : %w"
18+
failureWhileCreatingTableErrMsg = "failure while creating table %s: %w"
19+
failureWhileExecutingInsertStatementErrMsg = "failure while executing insert statement on table %s: %w"
20+
failureWhileQueryingRowErrMsg = "failure while querying row: %w"
21+
failureWhileExecutingBatchStatementErrMsg = "failure while executing batch upsert on table %s: %w"
22+
// Error messages returned from MySQL that we directly check for.
23+
valueNotFoundErrMsgFromSQlite = "no rows"
24+
)
25+
26+
var (
27+
errBlankDBPath = errors.New("DB Path for new SQLite DB provider can't be blank")
28+
errBlankStoreName = errors.New("store name is required")
29+
)

0 commit comments

Comments
 (0)