mirror of
https://github.com/netbirdio/netbird.git
synced 2026-09-21 14:19:08 +02:00
support for GetNetworkXIDToPublicIdMap in sqlite
Signed-off-by: Dmitri Dolguikh <dmitri.external@netbird.io>
This commit is contained in:
@@ -2,9 +2,9 @@ package networkmap_pgsql
|
||||
|
||||
import (
|
||||
"context"
|
||||
"database/sql"
|
||||
|
||||
"github.com/jackc/pgx/v5"
|
||||
networkmapdb "github.com/netbirdio/netbird/management/internals/network_map_db"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -14,16 +14,13 @@ const (
|
||||
`
|
||||
)
|
||||
|
||||
func (pgc *PgStoreConn) GetNetworks(ctx context.Context, accountId string) ([]network, error) {
|
||||
func (pgc *PgStoreConn) GetNetworkXIDToPublicIdMap(ctx context.Context, accountId string) (map[string]string, error) {
|
||||
rows, err := pgc.Conn.Query(ctx, GetNetworksQuery, accountId)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return pgx.CollectRows(rows, pgx.RowToStructByName[network])
|
||||
}
|
||||
|
||||
func (pgc *PgStoreConn) GetNetworkXIDToPublicIdMap(ctx context.Context, accountId string) (map[string]string, error) {
|
||||
networks, err := pgc.GetNetworks(ctx, accountId)
|
||||
networks, err := pgx.CollectRows(rows, pgx.RowToStructByName[networkmapdb.Network])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -37,8 +34,3 @@ func (pgc *PgStoreConn) GetNetworkXIDToPublicIdMap(ctx context.Context, accountI
|
||||
|
||||
return toret, nil
|
||||
}
|
||||
|
||||
type network struct {
|
||||
ID string
|
||||
PublicID sql.NullString
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user