Documentation
¶
Index ¶
- Constants
- type PgStore
- func (p *PgStore) BeginTx(ctx context.Context) (networkmapdb.NetworkMapDBStoreConn, error)
- func (p *PgStore) Exec(ctx context.Context, query string, args ...any) error
- func (p *PgStore) UsingConnection(c *pgx.Conn) networkmapdb.NetworkMapDBStoreConn
- func (p *PgStore) UsingTimeZone(location *time.Location)
- type PgStoreConn
- func (c *PgStoreConn) CommitTx(ctx context.Context) error
- func (pgc *PgStoreConn) GetAccountSettings(ctx context.Context, accountId string) (nmdata.AccountSettingsInfo, error)
- func (pgc *PgStoreConn) GetAllowedUsers(ctx context.Context, accountId string) (map[string]struct{}, map[string][]string, error)
- func (pgc *PgStoreConn) GetAppliedZoneCandidates(ctx context.Context, accountId string) ([]networkmap.AppliedZoneCandidate, error)
- func (pgc *PgStoreConn) GetDnsSettings(ctx context.Context, accountId string) (nmdata.DNSSettings, error)
- func (pgc *PgStoreConn) GetDomains(ctx context.Context, accountId string) ([]networkmapdb.Domain, error)
- func (pgc *PgStoreConn) GetGroups(ctx context.Context, accountId string) ([]nmdata.Group, map[string]map[string]any, error)
- func (pgc *PgStoreConn) GetNameServerGroups(ctx context.Context, accountId string) ([]nmdata.NameServerGroup, error)
- func (pgc *PgStoreConn) GetNetwork(ctx context.Context, accountId string) (nmdata.Network, error)
- func (pgc *PgStoreConn) GetNetworkResources(ctx context.Context, accountId string) ([]nmdata.NetworkResource, error)
- func (pgc *PgStoreConn) GetNetworkRouters(ctx context.Context, accountId string) (map[string]map[string]*nmdata.NetworkRouter, error)
- func (pgc *PgStoreConn) GetNetworkXIDToPublicIdMap(ctx context.Context, accountId string) (map[string]string, error)
- func (pgc *PgStoreConn) GetPeers(ctx context.Context, accountId string) ([]nmdata.Peer, map[string][]*nmdata.Peer, error)
- func (pgc *PgStoreConn) GetPolicies(ctx context.Context, accountId string) ([]nmdata.Policy, map[string]map[string]any, map[string]map[string]any, error)
- func (pgc *PgStoreConn) GetPostureChecks(ctx context.Context, accountId string) ([]nmdata.PostureChecks, map[string]string, error)
- func (pgc *PgStoreConn) GetPrivateServices(ctx context.Context, accountId string) ([]networkmapdb.Service, error)
- func (pgc *PgStoreConn) GetProxyTargetedDomainResourceIDs(ctx context.Context, accountId string) (map[string]struct{}, error)
- func (pgc *PgStoreConn) GetRoutes(ctx context.Context, accountId string) ([]nmdata.Route, error)
- func (c *PgStoreConn) RollbackTx(ctx context.Context) error
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 ¶
func NewPostgresqlStore ¶
func (*PgStore) BeginTx ¶
func (p *PgStore) BeginTx(ctx context.Context) (networkmapdb.NetworkMapDBStoreConn, error)
func (*PgStore) UsingConnection ¶
func (p *PgStore) UsingConnection(c *pgx.Conn) networkmapdb.NetworkMapDBStoreConn
func (*PgStore) UsingTimeZone ¶
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) GetAccountSettings ¶
func (pgc *PgStoreConn) GetAccountSettings(ctx context.Context, accountId string) (nmdata.AccountSettingsInfo, error)
func (*PgStoreConn) GetAllowedUsers ¶
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 (*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 (*PgStoreConn) GetPolicies ¶
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 (*PgStoreConn) RollbackTx ¶
func (c *PgStoreConn) RollbackTx(ctx context.Context) error
Click to show internal directories.
Click to hide internal directories.