networkmap_pgsql

package
v0.78.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 3, 2026 License: BSD-3-Clause, AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GetServicesQuery = `` /* 165-byte string literal not displayed */

	GetProxyTargetedDomainResourcesQuery = `` /* 229-byte string literal not displayed */

)
View Source
const (
	GetAllowedUserIdsQuery = `` /* 161-byte string literal not displayed */

	GetAllGroupIdQuery = `
	select array_agg(id) from groups
	where account_id=$1 and name='All'
	`
)
View Source
const (
	GetAccountSettingsQuery = `` /* 720-byte string literal not displayed */

)
View Source
const (
	GetAccountZonesQuery = `` /* 325-byte string literal not displayed */

)
View Source
const (
	GetDnsSettingsQuery = `
	select dns_settings_disabled_management_groups
	from accounts
	where id=$1
	`
)
View Source
const (
	GetDomainsQuery = `
	select domain, target_cluster
	from domains
	where account_id=$1 and domain<>'' and target_cluster<>''
	`
)
View Source
const (
	GetGroupsQuery = `` /* 226-byte string literal not displayed */

)
View Source
const (
	GetNameserversQuery = `` /* 164-byte string literal not displayed */

)
View Source
const (
	GetNetworkQuery = `` /* 163-byte string literal not displayed */

)
View Source
const (
	GetNetworkResourcesQuery = `` /* 143-byte string literal not displayed */

)
View Source
const (
	GetNetworkRouterQuery = `` /* 327-byte string literal not displayed */

)
View Source
const (
	GetNetworksQuery = `
	select id, public_id
	from networks where account_id=$1
	`
)
View Source
const (
	GetPeersQuery = `` /* 487-byte string literal not displayed */

)
View Source
const (
	GetPoliciesQuery = `` /* 374-byte string literal not displayed */

)
View Source
const (
	GetPostureChecksQuery = `
	select id, public_id, checks
	from posture_checks
	where account_id=$1
	`
)
View Source
const (
	GetRoutesQuery = `` /* 251-byte string literal not displayed */

)

Variables

This section is empty.

Functions

This section is empty.

Types

type PgStore

type PgStore struct {
	Pool     *pgxpool.Pool
	Location *time.Location
}

func NewPostgresqlStore

func NewPostgresqlStore(ctx context.Context, dsn string) (*PgStore, error)

func (*PgStore) BeginTx

func (*PgStore) Exec

func (p *PgStore) Exec(ctx context.Context, query string, args ...any) error

func (*PgStore) UsingConnection

func (p *PgStore) UsingConnection(c *pgx.Conn) networkmapdb.NetworkMapDBStoreConn

func (*PgStore) UsingTimeZone

func (p *PgStore) UsingTimeZone(location *time.Location)

This is used to control the timezone timestamps returned in. By default pgx returns timestamps in the local timezone, which may not be desirable. use .UsingTimeZone(time.UTC) to return timestamps in UTC TZ

type PgStoreConn

type PgStoreConn struct {
	Conn pgInterface
}

func (*PgStoreConn) CommitTx

func (c *PgStoreConn) CommitTx(ctx context.Context) error

func (*PgStoreConn) GetAccountSettings

func (pgc *PgStoreConn) GetAccountSettings(ctx context.Context, accountId string) (nmdata.AccountSettingsInfo, error)

func (*PgStoreConn) GetAllowedUsers

func (pgc *PgStoreConn) GetAllowedUsers(ctx context.Context, accountId string) (map[string]struct{}, map[string][]string, error)

func (*PgStoreConn) GetAppliedZoneCandidates

func (pgc *PgStoreConn) GetAppliedZoneCandidates(ctx context.Context, accountId string) ([]networkmap.AppliedZoneCandidate, error)

func (*PgStoreConn) GetDnsSettings

func (pgc *PgStoreConn) GetDnsSettings(ctx context.Context, accountId string) (nmdata.DNSSettings, error)

func (*PgStoreConn) GetDomains

func (pgc *PgStoreConn) GetDomains(ctx context.Context, accountId string) ([]networkmapdb.Domain, error)

func (*PgStoreConn) GetGroups

func (pgc *PgStoreConn) GetGroups(ctx context.Context, accountId string) ([]nmdata.Group, map[string]map[string]any, error)

we also return a resource-to-group index. an alternative is to add json indexes, query this directly. Not sure how expensive json indexes are. TODO (dmitri) verify and maybe change the implementation here.

func (*PgStoreConn) GetNameServerGroups

func (pgc *PgStoreConn) GetNameServerGroups(ctx context.Context, accountId string) ([]nmdata.NameServerGroup, error)

func (*PgStoreConn) GetNetwork

func (pgc *PgStoreConn) GetNetwork(ctx context.Context, accountId string) (nmdata.Network, error)

func (*PgStoreConn) GetNetworkResources

func (pgc *PgStoreConn) GetNetworkResources(ctx context.Context, accountId string) ([]nmdata.NetworkResource, error)

func (*PgStoreConn) GetNetworkRouters

func (pgc *PgStoreConn) GetNetworkRouters(ctx context.Context, accountId string) (map[string]map[string]*nmdata.NetworkRouter, error)

func (*PgStoreConn) GetNetworkXIDToPublicIdMap

func (pgc *PgStoreConn) GetNetworkXIDToPublicIdMap(ctx context.Context, accountId string) (map[string]string, error)

func (*PgStoreConn) GetPeers

func (pgc *PgStoreConn) GetPeers(ctx context.Context, accountId string) ([]nmdata.Peer, map[string][]*nmdata.Peer, error)

func (*PgStoreConn) GetPolicies

func (pgc *PgStoreConn) GetPolicies(ctx context.Context, accountId string) ([]nmdata.Policy, map[string]map[string]any, map[string]map[string]any, error)

func (*PgStoreConn) GetPostureChecks

func (pgc *PgStoreConn) GetPostureChecks(ctx context.Context, accountId string) ([]nmdata.PostureChecks, map[string]string, error)

func (*PgStoreConn) GetPrivateServices

func (pgc *PgStoreConn) GetPrivateServices(ctx context.Context, accountId string) ([]networkmapdb.Service, error)

func (*PgStoreConn) GetProxyTargetedDomainResourceIDs

func (pgc *PgStoreConn) GetProxyTargetedDomainResourceIDs(ctx context.Context, accountId string) (map[string]struct{}, error)

func (*PgStoreConn) GetRoutes

func (pgc *PgStoreConn) GetRoutes(ctx context.Context, accountId string) ([]nmdata.Route, error)

func (*PgStoreConn) RollbackTx

func (c *PgStoreConn) RollbackTx(ctx context.Context) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL