Skip to content

Commit

Permalink
Hint to improve strings concatination
Browse files Browse the repository at this point in the history
  • Loading branch information
baxiry committed Nov 18, 2024
1 parent 3b66674 commit f079716
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions engine/queryFuncs.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import (
"go.etcd.io/bbolt"
)

// TODO use strings.Builder for string concatunation

// Insert One
func (db *Store) insertOne(query gjson.Result) (res string) {

Expand Down Expand Up @@ -126,6 +128,7 @@ func (db *Store) findMany(query gjson.Result) (res string) {
records := "["

for i := 0; i < len(listData); i++ {
// Todo use strings.Builder
records += listData[i] + ","
}

Expand All @@ -134,6 +137,7 @@ func (db *Store) findMany(query gjson.Result) (res string) {
return "[]"
}

// Todo use strings.Builder
return records[:ln-1] + "]"
}

Expand All @@ -152,6 +156,7 @@ func (db *Store) findById(query gjson.Result) (res string) {
return nil
})
if err != nil {
// Todo use strings.Builder
return `{"error": "` + err.Error() + `"}`
}

Expand Down

0 comments on commit f079716

Please sign in to comment.