pkg/graphdb: some linting
Docker-DCO-1.1-Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com> (github: unclejack)
This commit is contained in:
parent
730301be76
commit
68c42446a1
1 changed files with 11 additions and 11 deletions
|
@ -131,8 +131,8 @@ func (db *Database) Set(fullPath, id string) (*Entity, error) {
|
||||||
if _, err := db.conn.Exec("BEGIN EXCLUSIVE"); err != nil {
|
if _, err := db.conn.Exec("BEGIN EXCLUSIVE"); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
var entityId string
|
var entityID string
|
||||||
if err := db.conn.QueryRow("SELECT id FROM entity WHERE id = ?;", id).Scan(&entityId); err != nil {
|
if err := db.conn.QueryRow("SELECT id FROM entity WHERE id = ?;", id).Scan(&entityID); err != nil {
|
||||||
if err == sql.ErrNoRows {
|
if err == sql.ErrNoRows {
|
||||||
if _, err := db.conn.Exec("INSERT INTO entity (id) VALUES(?);", id); err != nil {
|
if _, err := db.conn.Exec("INSERT INTO entity (id) VALUES(?);", id); err != nil {
|
||||||
rollback()
|
rollback()
|
||||||
|
@ -320,14 +320,14 @@ func (db *Database) RefPaths(id string) Edges {
|
||||||
|
|
||||||
for rows.Next() {
|
for rows.Next() {
|
||||||
var name string
|
var name string
|
||||||
var parentId string
|
var parentID string
|
||||||
if err := rows.Scan(&name, &parentId); err != nil {
|
if err := rows.Scan(&name, &parentID); err != nil {
|
||||||
return refs
|
return refs
|
||||||
}
|
}
|
||||||
refs = append(refs, &Edge{
|
refs = append(refs, &Edge{
|
||||||
EntityID: id,
|
EntityID: id,
|
||||||
Name: name,
|
Name: name,
|
||||||
ParentID: parentId,
|
ParentID: parentID,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
return refs
|
return refs
|
||||||
|
@ -443,11 +443,11 @@ func (db *Database) children(e *Entity, name string, depth int, entities []WalkM
|
||||||
defer rows.Close()
|
defer rows.Close()
|
||||||
|
|
||||||
for rows.Next() {
|
for rows.Next() {
|
||||||
var entityId, entityName string
|
var entityID, entityName string
|
||||||
if err := rows.Scan(&entityId, &entityName); err != nil {
|
if err := rows.Scan(&entityID, &entityName); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
child := &Entity{entityId}
|
child := &Entity{entityID}
|
||||||
edge := &Edge{
|
edge := &Edge{
|
||||||
ParentID: e.id,
|
ParentID: e.id,
|
||||||
Name: entityName,
|
Name: entityName,
|
||||||
|
@ -490,11 +490,11 @@ func (db *Database) parents(e *Entity) (parents []string, err error) {
|
||||||
defer rows.Close()
|
defer rows.Close()
|
||||||
|
|
||||||
for rows.Next() {
|
for rows.Next() {
|
||||||
var parentId string
|
var parentID string
|
||||||
if err := rows.Scan(&parentId); err != nil {
|
if err := rows.Scan(&parentID); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
parents = append(parents, parentId)
|
parents = append(parents, parentID)
|
||||||
}
|
}
|
||||||
|
|
||||||
return parents, nil
|
return parents, nil
|
||||||
|
|
Loading…
Reference in a new issue