'Deleting rows in GridDB cause issues

I'm getting some issues related to deleting rows in GridDB. It occurs when buttons are pressed, but sometimes it deletes, sometimes it does not. Any help would be greatly appreciated. Below is the code

conInfo, err := griddb_go.CreateContainerInfo("Users",

[][]interface{}{

  {"username", griddb_go.TYPE_STRING},

  {"email", griddb_go.TYPE_STRING},

  {"password", griddb_go.TYPE_BLOB}
},

  griddb_go.CONTAINER_COLLECTION,

  true
)

if err != nil {

  fmt.Println("Create containerInfo failed")

}

col, err := gridstore.PutContainer(conInfo, true)

if err != nil {

  fmt.Println("put container failed")

}

query, err := col.Query(fmt.Sprintf("SELECT * WHERE username='%s'", username))

if err != nil {

  fmt.Println("create query failed")

}

rs, err := query.Fetch(false)

if err != nil {

  fmt.Println("create rs from query failed")

}

col.SetAutoCommit(false)
  
if rs.HasNext() {

  rrow, err := rs.NextRow()

  if err != nil {

    fmt.Println("Error retrieving row")

  }

  //deletes user

  col.Remove(rrow[0])

  col.Commit()

} else {

  fmt.Println("error. Has Next Failed")

}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source