/** * Yats - yats * * This file is licensed under the Affero General Public License version 3 or * later. See the COPYING file. * * @author Paolo Lulli * @copyright Paolo Lulli 2024 */ package db import ( "fmt" "time" "yats/internal/model" "github.com/gocql/gocql" ) func GetClientsList(session *gocql.Session) []model.ClientInfo { var clients []model.ClientInfo m := map[string]interface{}{} q := fmt.Sprintf("SELECT id, created, name FROM client") fmt.Println(q) iter := session.Query(q).Iter() for iter.MapScan(m) { clients = append(clients, model.ClientInfo{ ID: m["id"].(string), Created: m["created"].(time.Time).UnixMilli(), Name: m["name"].(string), }) m = map[string]interface{}{} } return clients }