covert indentation tabs to spaces
This commit is contained in:
parent
219695f795
commit
6486fb7f3b
1 changed files with 19 additions and 19 deletions
|
@ -1,15 +1,15 @@
|
||||||
package z
|
package z
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"sort"
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/tidwall/buntdb"
|
"github.com/tidwall/buntdb"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Database struct {
|
type Database struct {
|
||||||
|
@ -69,20 +69,20 @@ func (database *Database) AddEntry(user string, entry Entry, setRunning bool) (s
|
||||||
}
|
}
|
||||||
|
|
||||||
func (database *Database) GetEntry(user string, entryId string) (Entry, error) {
|
func (database *Database) GetEntry(user string, entryId string) (Entry, error) {
|
||||||
var entry Entry
|
var entry Entry
|
||||||
|
|
||||||
dberr := database.DB.View(func(tx *buntdb.Tx) error {
|
dberr := database.DB.View(func(tx *buntdb.Tx) error {
|
||||||
value, err := tx.Get(user + ":entry:" + entryId)
|
value, err := tx.Get(user + ":entry:" + entryId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
json.Unmarshal([]byte(value), &entry)
|
json.Unmarshal([]byte(value), &entry)
|
||||||
|
|
||||||
entry.ID = entryId
|
entry.ID = entryId
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
|
|
||||||
return entry, dberr
|
return entry, dberr
|
||||||
}
|
}
|
||||||
|
|
||||||
func (database *Database) UpdateEntry(user string, entry Entry) (string, error) {
|
func (database *Database) UpdateEntry(user string, entry Entry) (string, error) {
|
||||||
|
|
Loading…
Reference in a new issue