Skip to content

Commit

Permalink
stuff idk man fuck
Browse files Browse the repository at this point in the history
  • Loading branch information
dezren39 committed Nov 15, 2023
1 parent fbefff4 commit 390d603
Show file tree
Hide file tree
Showing 5 changed files with 89 additions and 47 deletions.
5 changes: 5 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,9 @@
"cSpell.words": [
"Infof"
],
"workbench.colorCustomizations": {
"activityBar.background": "#1E3132",
"titleBar.activeBackground": "#2B4446",
"titleBar.activeForeground": "#F8FBFB"
},
}
39 changes: 39 additions & 0 deletions go.work.sum
Original file line number Diff line number Diff line change
@@ -1 +1,40 @@
github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be/go.mod h1:ySMOLuWl6zY27l47sB3qLNK6tF2fkHG55UZxx8oIVo4=
github.com/auth0/go-jwt-middleware/v2 v2.0.1/go.mod h1:kDt7JgUuDEp1VutfUmO4ZxBLL51vlNu/56oDfXc5E0Y=
github.com/aymanbagabas/go-osc52 v1.2.1 h1:q2sWUyDcozPLcLabEMd+a+7Ea2DitxZVN9hTxab9L4E=
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
github.com/charmbracelet/ssh v0.0.0-20221117183211-483d43d97103/go.mod h1:0Vm2/8yBljiLDnGJHU8ehswfawrEybGk33j5ssqKQVM=
github.com/charmbracelet/wish v1.1.1/go.mod h1:xh4KZpSULw+Xqb9bcbhw92QAinVB75CVLWrFuyY6IVs=
github.com/inconshreveable/mousetrap v1.0.1/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8=
github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4=
github.com/meowgorithm/babylogger v1.2.0/go.mod h1:Kmw1fbhkP4sLJmhiGIpThiG+guQAQ8dQ3GnLa+8Fjf0=
github.com/muesli/mango v0.1.0/go.mod h1:5XFpbC8jY5UUv89YQciiXNlbi+iJgt29VDC5xbzrLL4=
github.com/muesli/mango-cobra v1.2.0/go.mod h1:vMJL54QytZAJhCT13LPVDfkvCUJ5/4jNUKF/8NC2UjA=
github.com/muesli/mango-pflag v0.1.0/go.mod h1:YEQomTxaCUp8PrbhFh10UfbhbQrM/xJ4i2PB8VTLLW0=
github.com/muesli/roff v0.1.0/go.mod h1:pjAHQM9hdUUwm/krAfrLGgJkXJ+YuhtsfZ42kieB2Ig=
github.com/muesli/toktok v0.1.0/go.mod h1:Xw5/tQTHg6L4aw9jXmBKxjiO3eMn/Fe6IDc8NbBSOMw=
github.com/prometheus/client_golang v1.15.1/go.mod h1:e9yaBhRPU2pPNsZwE+JdQl0KEt1N9XgF6zxWmaC0xOk=
github.com/prometheus/client_model v0.3.0/go.mod h1:LDGWKZIo7rky3hgvBe+caln+Dr3dPggB5dvjtD7w9+w=
github.com/prometheus/common v0.42.0/go.mod h1:xBwqVerjNdUDjgODMpudtOMwlOwf2SaTr1yjz4b7Zbc=
github.com/prometheus/procfs v0.9.0/go.mod h1:+pB4zwohETzFnmlpe6yd2lSc+0/46IYZRB/chUwxUZY=
github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=
github.com/spf13/cobra v1.6.1/go.mod h1:IOw/AERYS7UzyrGinqmz6HLUo219MORXGxhbaJUqzrY=
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673/go.mod h1:N3UwUGtsrSj3ccvlPHLoLsHnpR27oXr4ZE984MbSER8=
goji.io v2.0.2+incompatible/go.mod h1:sbqFwrtqZACxLBTQcdgVjFh54yGVCvwq8+w49MVMMIk=
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f/go.mod h1:RGgjbofJ8xD9Sq1VVhDM1Vok1vRONV+rg+CjzG4SZKM=
google.golang.org/grpc v1.53.0/go.mod h1:OnIrk0ipVdj4N5d9IUoFUx72/VlD7+jUsHwZgwSMQpw=
gopkg.in/square/go-jose.v2 v2.6.0/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI=
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
lukechampine.com/uint128 v1.1.1/go.mod h1:c4eWIwlEGaxC/+H1VguhU4PHXNWDCDMUlWdIWl2j1gk=
modernc.org/cc/v3 v3.36.0/go.mod h1:NFUHyPn4ekoC/JHeZFfZurN6ixxawE1BnVonP/oahEI=
modernc.org/ccgo/v3 v3.16.8/go.mod h1:zNjwkizS+fIFDrDjIAgBSCLkWbJuHF+ar3QRn+Z9aws=
modernc.org/libc v1.16.19/go.mod h1:p7Mg4+koNjc8jkqwcoFBJx7tXkpj00G77X7A72jXPXA=
modernc.org/mathutil v1.4.1/go.mod h1:mZW8CKdRPY1v87qxC/wUdX5O1qDzXMP5TH3wjfpga6E=
modernc.org/memory v1.1.1/go.mod h1:/0wo5ibyrQiaoUoH7f9D8dnglAmILJ5/cxZlRECf+Nw=
modernc.org/opt v0.1.1/go.mod h1:WdSiB5evDcignE70guQKxYUl14mgWtbClRi5wmkkTX0=
modernc.org/sqlite v1.18.1/go.mod h1:6ho+Gow7oX5V+OiOQ6Tr4xeqbx13UZ6t+Fw9IRUG4d4=
modernc.org/strutil v1.1.1/go.mod h1:DE+MQQ/hjKBZS2zNInV5hhcipt5rLPWkmpbGeW5mmdw=
modernc.org/token v1.0.0/go.mod h1:UGzOrNV1mAFSEB63lOFHIpNRUVMvYTc6yu1SMY/XTDM=
3 changes: 1 addition & 2 deletions sources/graph/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.21.3
require (
github.com/charmbracelet/charm v0.12.6
github.com/charmbracelet/log v0.2.5
github.com/dgraph-io/badger/v4 v4.2.0
github.com/dgraph-io/badger/v3 v3.2103.2
)

require (
Expand All @@ -20,7 +20,6 @@ require (
github.com/charmbracelet/keygen v0.4.2 // indirect
github.com/charmbracelet/lipgloss v0.8.0 // indirect
github.com/containerd/console v1.0.3 // indirect
github.com/dgraph-io/badger/v3 v3.2103.2 // indirect
github.com/dgraph-io/ristretto v0.1.1 // indirect
github.com/dustin/go-humanize v1.0.0 // indirect
github.com/go-logfmt/logfmt v0.6.0 // indirect
Expand Down
2 changes: 0 additions & 2 deletions sources/graph/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/dgraph-io/badger/v3 v3.2103.2 h1:dpyM5eCJAtQCBcMCZcT4UBZchuTJgCywerHHgmxfxM8=
github.com/dgraph-io/badger/v3 v3.2103.2/go.mod h1:RHo4/GmYcKKh5Lxu63wLEMHJ70Pac2JqZRYGhlyAo2M=
github.com/dgraph-io/badger/v4 v4.2.0 h1:kJrlajbXXL9DFTNuhhu9yCx7JJa4qpYWxtE8BzuWsEs=
github.com/dgraph-io/badger/v4 v4.2.0/go.mod h1:qfCqhPoWDFJRx1gp5QwwyGo8xk1lbHUxvK9nK0OGAak=
github.com/dgraph-io/ristretto v0.1.0/go.mod h1:fux0lOrBhrVCJd3lcTHsIJhq1T2rokOu6v9Vcb3Q9ug=
github.com/dgraph-io/ristretto v0.1.1 h1:6CWw5tJNgpegArSHpNHJKldNeq03FQCwYvfMVWajOK8=
github.com/dgraph-io/ristretto v0.1.1/go.mod h1:S1GPSBCYCIhmVNfcth17y2zZtQT6wzkzgwUve0VDWWA=
Expand Down
87 changes: 44 additions & 43 deletions sources/graph/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,23 @@ package main
import (
"github.com/charmbracelet/charm/kv"
"github.com/charmbracelet/log"
badger "github.com/dgraph-io/badger/v4"
badger "github.com/dgraph-io/badger/v3"
)

func handle(err error) {
if err != nil {
log.Fatal(err)
}
if err != nil {
log.Fatal(err)
}
}

func main() {
log.Info("Hello flake")

// Open the Badger database located in the /tmp/badger directory.
// It will be created if it doesn't exist.
db, err := badger.Open(badger.DefaultOptions("badger"))
handle(err)
defer db.Close()
// It will be created if it doesn't exist.
db, err := badger.Open(badger.DefaultOptions("badger"))
handle(err)
defer db.Close()

err = db.Update(func(txn *badger.Txn) error {
err := txn.Set([]byte("answer"), []byte("42"))
Expand All @@ -31,17 +32,17 @@ func main() {

var valCopy []byte
// err = item.Value(func(val []byte) error {
// This func with val would only be called if item.Value encounters no error.
// This func with val would only be called if item.Value encounters no error.

// Accessing val here is valid.
// log.Infof("The answer is: %s\n", val)
// Accessing val here is valid.
// log.Infof("The answer is: %s\n", val)

// Copying or parsing val is valid.
// valCopy = append([]byte{}, val...)
// Copying or parsing val is valid.
// valCopy = append([]byte{}, val...)

// Assigning val slice to another variable is NOT OK.
// valNot = val // Do not do this.
// return nil
// Assigning val slice to another variable is NOT OK.
// valNot = val // Do not do this.
// return nil
// })
// handle(err)

Expand All @@ -59,31 +60,31 @@ func main() {
return nil
})

cdb, err := kv.OpenWithDefaults("my-cute-db")
if err != nil {
log.Fatal(err)
}
defer cdb.Close()

if food, err := cdb.Get([]byte("fave-food")); err != nil {
log.Fatal(err)
} else {
log.Info("My fave food is:")
log.Info("", "food", string(food))
}

if err := cdb.Sync(); err != nil {
log.Fatal(err)
}

if err := cdb.Set([]byte("fave-food"), []byte("gherkin")); err != nil {
log.Fatal(err)
}

if food, err := cdb.Get([]byte("fave-food")); err != nil {
log.Fatal(err)
} else {
log.Info("Is your fave food:")
log.Info("", "food", string(food))
}
cdb, err := kv.OpenWithDefaults("my-cute-db")
if err != nil {
log.Fatal(err)
}
defer cdb.Close()

if food, err := cdb.Get([]byte("fave-food")); err != nil {
log.Fatal(err)
} else {
log.Info("My fave food is:")
log.Info("", "food", string(food))
}

if err := cdb.Sync(); err != nil {
log.Fatal(err)
}

if err := cdb.Set([]byte("fave-food"), []byte("gherkin")); err != nil {
log.Fatal(err)
}

if food, err := cdb.Get([]byte("fave-food")); err != nil {
log.Fatal(err)
} else {
log.Info("Is your fave food:")
log.Info("", "food", string(food))
}
}

0 comments on commit 390d603

Please sign in to comment.