support for GetNetworkXIDToPublicIdMap in sqlite

Signed-off-by: Dmitri Dolguikh <dmitri.external@netbird.io>
This commit is contained in:
Dmitri Dolguikh
2026-08-11 10:51:34 +02:00
parent 3da27221ac
commit fad568fdb0
4 changed files with 43 additions and 14 deletions
@@ -0,0 +1,35 @@
package networkmap_sqlite
import (
"context"
networkmapdb "github.com/netbirdio/netbird/management/internals/network_map_db"
)
const (
GetNetworksQuery = `
select id, public_id
from networks where account_id=?
`
)
func (sc *SqliteStoreConn) GetNetworkXIDToPublicIdMap(ctx context.Context, accountId string) (map[string]string, error) {
rows, err := sc.Conn.QueryContext(ctx, GetNetworksQuery, accountId)
if err != nil {
return nil, err
}
networks, err := CollectRowsForSqlite[networkmapdb.Network](rows)
if err != nil {
return nil, err
}
toret := make(map[string]string)
for _, n := range networks {
if n.PublicID.Valid {
toret[n.ID] = n.PublicID.String
}
}
return toret, nil
}
@@ -135,9 +135,6 @@ func (s *SqliteStoreConn) GetPostureChecks(ctx context.Context, accountId string
func (s *SqliteStoreConn) GetAllowedUsers(ctx context.Context, accountId string) (map[string]struct{}, map[string][]string, error) {
return nil, nil, nil
}
func (s *SqliteStoreConn) GetNetworkXIDToPublicIdMap(ctx context.Context, accountId string) (map[string]string, error) {
return nil, nil
}
func (s *SqliteStoreConn) GetPrivateServices(ctx context.Context, accountId string) ([]networkmapdb.Service, error) {
return nil, nil
}