Compare commits

..

No commits in common. "bf505423aa6f9a05d1631c30c4a0cf224c5a77b8" and "a593d23f23e89d747490a06f7d68cc7a669139ff" have entirely different histories.

3 changed files with 1 additions and 51 deletions

2
.gitignore vendored
View file

@ -1,2 +0,0 @@
*.sqlite
mast

View file

@ -7,7 +7,7 @@ import (
"log"
"os"
mast "mast/db"
"mast/db"
"github.com/charmbracelet/bubbles/textinput"
tea "github.com/charmbracelet/bubbletea"
@ -89,8 +89,6 @@ func (m *model) addTodo(todo string) {
panic(err)
}
// TODO:
// func sync_changes
rows, err := m.db.Query("SELECT * FROM crsql_changes")
if err != nil {
log.Println("Error querying crsql_changes:", err)

View file

@ -1,46 +0,0 @@
package main
import (
"encoding/base64"
"fmt"
"strconv"
"strings"
)
func decodeBase64ToIntArray(encodedString string) ([]int, error) {
// Decode the base64 string
decodedBytes, err := base64.StdEncoding.DecodeString(encodedString)
if err != nil {
return nil, fmt.Errorf("error decoding base64: %w", err)
}
// Convert bytes to string
decodedString := string(decodedBytes)
// Split the string by commas
stringSlice := strings.Split(decodedString, ",")
// Convert each string to an integer
intSlice := make([]int, len(stringSlice))
for i, s := range stringSlice {
num, err := strconv.Atoi(s)
if err != nil {
return nil, fmt.Errorf("error converting string to int: %w", err)
}
intSlice[i] = num
}
return intSlice, nil
}
func main2() {
encodedString := "MSwxMSwzMiw1MCw5OCw1Nyw1Myw1NywxMDIsNTAsNTQsNTIsNTYsMTAyLDEwMCwxMDAsOTksNTEsNTQsNTcsMTAwLDk3LDEwMCwxMDIsMTAxLDU0LDQ5LDUzLDk5LDQ4LDEwMCw0OSw1NCwxMDIsNTI="
intArray, err := decodeBase64ToIntArray(encodedString)
if err != nil {
fmt.Println("Error:", err)
return
}
fmt.Println("Decoded integer array:", intArray)
}