this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

trying sqlite

+25 -2
+3 -2
go.mod
··· 6 6 github.com/avast/retry-go/v4 v4.6.0 7 7 github.com/bluesky-social/indigo v0.0.0-20241031232035-1a73c3fb6841 8 8 github.com/bluesky-social/jetstream v0.0.0-20241031234625-0ab10bd041fe 9 + github.com/bugsnag/bugsnag-go/v2 v2.5.1 9 10 github.com/golang-jwt/jwt/v5 v5.2.1 10 - github.com/gorilla/websocket v1.5.1 11 + github.com/mattn/go-sqlite3 v1.14.22 11 12 ) 12 13 13 14 require ( 14 15 github.com/beorn7/perks v1.0.1 // indirect 15 - github.com/bugsnag/bugsnag-go/v2 v2.5.1 // indirect 16 16 github.com/bugsnag/panicwrap v1.3.4 // indirect 17 17 github.com/carlmjohnson/versioninfo v0.22.5 // indirect 18 18 github.com/cespare/xxhash/v2 v2.3.0 // indirect ··· 22 22 github.com/goccy/go-json v0.10.2 // indirect 23 23 github.com/gogo/protobuf v1.3.2 // indirect 24 24 github.com/google/uuid v1.6.0 // indirect 25 + github.com/gorilla/websocket v1.5.1 // indirect 25 26 github.com/hashicorp/go-cleanhttp v0.5.2 // indirect 26 27 github.com/hashicorp/go-retryablehttp v0.7.5 // indirect 27 28 github.com/hashicorp/golang-lru v1.0.2 // indirect
+3
go.sum
··· 4 4 github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= 5 5 github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= 6 6 github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= 7 + github.com/bitly/go-simplejson v0.5.1 h1:xgwPbetQScXt1gh9BmoJ6j9JMr3TElvuIyjR8pgdoow= 7 8 github.com/bitly/go-simplejson v0.5.1/go.mod h1:YOPVLzCfwK14b4Sff3oP1AmGhI9T9Vsg84etUnlyp+Q= 8 9 github.com/bluesky-social/indigo v0.0.0-20241031232035-1a73c3fb6841 h1:HCj4iBoAV59Fn1vsEhbeEMOExR4vOrUgz+sxUoV+F6s= 9 10 github.com/bluesky-social/indigo v0.0.0-20241031232035-1a73c3fb6841/go.mod h1:Zx9nSWgd/FxMenkJW07VKnzspxpHBdPrPmS+Fspl2I0= ··· 104 105 github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= 105 106 github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= 106 107 github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= 108 + github.com/mattn/go-sqlite3 v1.14.22 h1:2gZY6PC6kBnID23Tichd1K+Z0oS6nE/XwU+Vz/5o4kU= 109 + github.com/mattn/go-sqlite3 v1.14.22/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y= 107 110 github.com/minio/sha256-simd v1.0.1 h1:6kaan5IFmwTNynnKKpDHe6FWHohJOHhCPchzK49dzMM= 108 111 github.com/minio/sha256-simd v1.0.1/go.mod h1:Pz6AKMiUdngCLpeTL/RJY1M9rUuPMYujV5xJjtbRSN8= 109 112 github.com/mr-tron/base58 v1.2.0 h1:T/HDJBh4ZCPbU39/+c3rRvE0uKBQlU27+QI8LJ4t64o=
+19
main.go
··· 2 2 3 3 import ( 4 4 "context" 5 + "database/sql" 5 6 "errors" 6 7 "fmt" 8 + "log" 7 9 "log/slog" 8 10 "os" 9 11 "os/signal" ··· 12 14 13 15 "github.com/avast/retry-go/v4" 14 16 "github.com/bugsnag/bugsnag-go/v2" 17 + _ "github.com/mattn/go-sqlite3" 15 18 ) 16 19 17 20 const ( 18 21 jsServerAddr = "wss://jetstream.atproto.tools/subscribe" 19 22 ) 23 + 24 + func db() { 25 + os.Remove("sqlite-database.db") // I delete the file to avoid duplicated records. 26 + // SQLite is a file based database. 27 + 28 + log.Println("Creating sqlite-database.db...") 29 + file, err := os.Create("sqlite-database.db") // Create SQLite file 30 + if err != nil { 31 + bugsnag.Notify(fmt.Errorf("create db: %w", err)) 32 + } 33 + file.Close() 34 + log.Println("sqlite-database.db created") 35 + 36 + sqliteDatabase, _ := sql.Open("sqlite3", "./sqlite-database.db") // Open the created SQLite File 37 + defer sqliteDatabase.Close() // Defer Closing the database 38 + } 20 39 21 40 func main() { 22 41 signals := make(chan os.Signal, 1)