this repo has no description
0
fork

Configure Feed

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

write and read

-19
-19
main.go
··· 2 2 3 3 import ( 4 4 "context" 5 - "database/sql" 6 5 "errors" 7 6 "fmt" 8 - "log" 9 7 "log/slog" 10 8 "os" 11 9 "os/signal" ··· 14 12 15 13 "github.com/avast/retry-go/v4" 16 14 "github.com/bugsnag/bugsnag-go/v2" 17 - _ "github.com/mattn/go-sqlite3" 18 15 ) 19 16 20 17 const ( 21 18 jsServerAddr = "wss://jetstream.atproto.tools/subscribe" 22 19 ) 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 - } 39 20 40 21 func main() { 41 22 signals := make(chan os.Signal, 1)