dbhelpers

package
v1.1.5-retractions Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2022 License: Apache-2.0, BSD-2-Clause, BSD-3-Clause, + 1 more Imports: 12 Imported by: 225

Documentation

Index

Constants

View Source
const BaseLimit = "\nLIMIT"
View Source
const BaseOffset = "\nOFFSET"
View Source
const BaseOrderBy = "\nORDER BY"
View Source
const BaseWhere = "\nWHERE"

Variables

This section is empty.

Functions

func AddTenancyCheck

func AddTenancyCheck(where string, queryValues map[string]interface{}, tenantColumnName string, tenantIDs []int) (string, map[string]interface{})

AddTenancyCheck takes a WHERE clause (can be ""), the associated queryValues (can be empty), a tenantColumnName that should provide a bigint corresponding to the tenantID of the object being checked (this may require a CAST), and an array of the tenantIDs the user has access to; it returns a where clause and associated queryValues including filtering based on tenancy.

func AppendWhere

func AppendWhere(where, extra string) string

AppendWhere appends 'extra' safely to the WHERE clause 'where'. What is returned is guaranteed to be a valid WHERE clause (including a blank string), provided the supplied 'where' and 'extra' clauses are valid.

func BuildWhereAndOrderByAndPagination

func BuildWhereAndOrderByAndPagination(parameters map[string]string, queryParamsToSQLCols map[string]WhereColumnInfo) (string, string, string, map[string]interface{}, []error)

func CDNExists

func CDNExists(cdnName string, tx *sql.Tx) (bool, error)

Returns true if the cdn exists

func CachegroupHasTopologyBasedDeliveryServicesOnCDN

func CachegroupHasTopologyBasedDeliveryServicesOnCDN(tx *sql.Tx, cachegroupID int, CDNID int) (bool, error)

CheckCachegroupHasTopologyBasedDeliveryServicesOnCDN returns true if the given cachegroup is assigned to any topologies with delivery services assigned on the given CDN.

func CachegroupParameterAssociationExists

func CachegroupParameterAssociationExists(id int, cachegroup int, tx *sql.Tx) (bool, error)

CachegroupParameterAssociationExists returns whether a cachegroup parameter association with the given parameter id exists, and any error.

func CheckIfCurrentUserCanModifyCDN

func CheckIfCurrentUserCanModifyCDN(tx *sql.Tx, cdn, user string) (error, error, int)

CheckIfCurrentUserCanModifyCDN checks if the current user has the lock on the cdn that the requested operation is to be performed on. This will succeed if the either there is no lock by any user on the CDN, or if the current user has the lock on the CDN.

func CheckIfCurrentUserCanModifyCDNWithID

func CheckIfCurrentUserCanModifyCDNWithID(tx *sql.Tx, cdnID int64, user string) (error, error, int)

CheckIfCurrentUserCanModifyCDNWithID checks if the current user has the lock on the cdn (identified by ID) that the requested operation is to be performed on. This will succeed if the either there is no lock by any user on the CDN, or if the current user has the lock on the CDN.

func CheckIfCurrentUserCanModifyCDNs

func CheckIfCurrentUserCanModifyCDNs(tx *sql.Tx, cdns []string, user string) (error, error, int)

CheckIfCurrentUserCanModifyCDNs checks if the current user has the lock on the list of cdns that the requested operation is to be performed on. This will succeed if the either there is no lock by any user on any of the CDNs, or if the current user has the lock on any of the CDNs.

func CheckIfCurrentUserCanModifyCDNsByID

func CheckIfCurrentUserCanModifyCDNsByID(tx *sql.Tx, cdns []int, user string) (error, error, int)

CheckIfCurrentUserCanModifyCDNs checks if the current user has the lock on the list of cdns(identified by ID) that the requested operation is to be performed on. This will succeed if the either there is no lock by any user on any of the CDNs, or if the current user has the lock on any of the CDNs.

func CheckIfCurrentUserCanModifyCachegroup

func CheckIfCurrentUserCanModifyCachegroup(tx *sql.Tx, cachegroupID int, user string) (error, error, int)

CheckIfCurrentUserCanModifyCachegroup checks if the current user has the lock on the cdns that are associated with the provided cachegroup ID. This will succeed if no other user has a hard lock on any of the CDNs that relate to the cachegroup in question.

func CheckIfCurrentUserCanModifyCachegroups

func CheckIfCurrentUserCanModifyCachegroups(tx *sql.Tx, cachegroupIDs []int, user string) (error, error, int)

CheckIfCurrentUserCanModifyCachegroups checks if the current user has the lock on the cdns that are associated with the provided cachegroup IDs. This will succeed if no other user has a hard lock on any of the CDNs that relate to the cachegroups in question.

func CheckIfCurrentUserHasCdnLock

func CheckIfCurrentUserHasCdnLock(tx *sql.Tx, cdn, user string) (error, error, int)

CheckIfCurrentUserHasCdnLock checks if the current user has the lock on the cdn that the requested operation is to be performed on. This will succeed if the either there is no lock by any user on the CDN, or if the current user has the lock on the CDN.

func CheckOriginServerInDSCG

func CheckOriginServerInDSCG(tx *sql.Tx, dsID int, dsTopology string) (error, error, int)

CheckOriginServerInDSCG checks if a DS has ORG server and if it does, to make sure the cachegroup is part of DS

func CheckTopology

func CheckTopology(tx *sqlx.Tx, ds tc.DeliveryServiceV4) (int, error, error)

CheckTopology returns an error if the given Topology does not exist or if one of the Topology's Cache Groups is empty with respect to the Delivery Service's CDN. Note that this can panic if ds does not have a properly set CDNID.

func CheckTopologyOrgServerCGInDSCG

func CheckTopologyOrgServerCGInDSCG(tx *sql.Tx, cdnIds []int, dsTopology string, topologyCGNames []string) (error, error, int)

CheckTopologyOrgServerCGInDSCG checks if ORG server are part of DS. IF they are then the user is not allowed to remove the ORG servers from the associated DS's topology

func CommitIf

func CommitIf(tx *sql.Tx, doCommit *bool)

CommitIf commits if doCommit is true at the time of execution. This is designed as a defer helper.

Example:

tx, err := db.Begin()
txCommit := false
defer dbhelpers.CommitIf(tx, &txCommit)
if err := tx.Exec("select ..."); err != nil {
  return errors.New("executing: " + err.Error())
}
txCommit = true
return nil

func DSRExistsWithXMLID

func DSRExistsWithXMLID(xmlid string, tx *sql.Tx) (bool, error)

DSRExistsWithXMLID returns whether or not an **open** Delivery Service Request with the given xmlid exists, and any error that occurred.

func DequeueUpdateForServer

func DequeueUpdateForServer(tx *sql.Tx, serverID int64) error

DequeueUpdateForServer sets the config update time equal to the config apply time, thereby effectively dequeueing any pending updates for the server specified.

func DequeueUpdateForServerWithCachegroupCDN

func DequeueUpdateForServerWithCachegroupCDN(tx *sql.Tx, cgID int, cdnID int64) ([]tc.CacheName, error)

DequeueUpdateForServerWithCachegroupCDN sets the config update time equal to the config apply time, thereby effectively dequeueing any pending updates for the servers specified by the cachegroup (id) and the cdn (id).

func DequeueUpdateForServerWithTopologyCDN

func DequeueUpdateForServerWithTopologyCDN(tx *sql.Tx, topologyName tc.TopologyName, cdnId int64) error

DequeueUpdateForServerWithTopologyCDN sets the config update time equal to the config apply time, thereby effectively dequeueing any pending updates for the servers specified by the topology (name) and the cdn (id).

func GetCDNDSes

func GetCDNDSes(tx *sql.Tx, cdn tc.CDNName) (map[string]struct{}, error)

func GetCDNDomainFromName

func GetCDNDomainFromName(tx *sql.Tx, cdnName tc.CDNName) (string, bool, error)

GetCDNDomainFromName returns the domain, whether the cdn exists, and any error.

func GetCDNIDFromFedID

func GetCDNIDFromFedID(id int, tx *sql.Tx) (int, bool, error)

GetCDNIDFromFedID returns the ID of the CDN for the current federation.

func GetCDNIDFromName

func GetCDNIDFromName(tx *sql.Tx, name tc.CDNName) (int, bool, error)

GetCDNIDFromName returns the ID of the CDN if a CDN with the name exists

func GetCDNIDsFromFedResolverID

func GetCDNIDsFromFedResolverID(id int, tx *sql.Tx) ([]int, bool, error)

GetCDNIDFromFedResolverID returns the IDs of the CDNs that the fed resolver is associated with.

func GetCDNNameDomain

func GetCDNNameDomain(cdnID int, tx *sql.Tx) (string, string, error)

GetCDNNameDomain returns the name and domain for a given CDN ID.

func GetCDNNameFromDSXMLID

func GetCDNNameFromDSXMLID(tx *sql.Tx, dsXMLID string) (string, error)

GetCDNNameFromDSXMLID returns the CDN name of the DS associated with the supplied XML ID

func GetCDNNameFromID

func GetCDNNameFromID(tx *sql.Tx, id int64) (tc.CDNName, bool, error)

GetCDNNameFromID gets the CDN name from the given CDN ID.

func GetCDNNameFromProfileID

func GetCDNNameFromProfileID(tx *sql.Tx, id int) (tc.CDNName, error)

GetCDNNameFromProfileID returns the cdn name for the provided profile ID.

func GetCDNNameFromProfileName

func GetCDNNameFromProfileName(tx *sql.Tx, profileName string) (tc.CDNName, error)

GetCDNNameFromProfileName returns the cdn name for the provided profile name.

func GetCDNNameFromServerID

func GetCDNNameFromServerID(tx *sql.Tx, serverId int64) (tc.CDNName, error)

GetCDNNameFromServerID gets the CDN name for the server with the given ID.

func GetCDNNamesFromDSIds

func GetCDNNamesFromDSIds(tx *sql.Tx, dsIds []int) ([]string, error)

GetCDNNamesFromDSIds returns a list of cdn names for a list of DS IDs.

func GetCDNNamesFromProfileIDs

func GetCDNNamesFromProfileIDs(tx *sql.Tx, profileIDs []int64) ([]string, error)

GetCDNNamesFromProfileIDs returns a list of cdn names for a list of profile IDs.

func GetCDNNamesFromServerIds

func GetCDNNamesFromServerIds(tx *sql.Tx, serverIds []int64) ([]string, error)

GetCDNNamesFromServerIds returns a list of cdn names for a list of server IDs.

func GetCDNs

func GetCDNs(tx *sql.Tx) (map[tc.CDNName]struct{}, error)

func GetCacheGroupNameFromID

func GetCacheGroupNameFromID(tx *sql.Tx, id int) (tc.CacheGroupName, bool, error)

GetCacheGroupNameFromID Get Cache Group name from a given ID

func GetCapabilitiesFromRoleID

func GetCapabilitiesFromRoleID(tx *sql.Tx, roleID int) ([]string, error)

GetCapabilitiesFromRoleID returns the capabilities for the supplied role ID.

func GetCapabilitiesFromRoleName

func GetCapabilitiesFromRoleName(tx *sql.Tx, role string) ([]string, error)

GetCapabilitiesFromRoleName returns the capabilities for the supplied role name.

func GetCommonServerPropertiesFromV4

func GetCommonServerPropertiesFromV4(s tc.ServerV40, tx *sql.Tx) (tc.CommonServerProperties, error)

GetCommonServerPropertiesFromV4 converts ServerV40 to CommonServerProperties struct.

func GetDSCDNIdFromID

func GetDSCDNIdFromID(tx *sql.Tx, dsID int) (int, bool, error)

GetDSCDNIdFromID loads the DeliveryService's cdn ID from the database, from the delivery service ID. Returns whether the delivery service was found, and any error.

func GetDSIDAndCDNFromName

func GetDSIDAndCDNFromName(tx *sql.Tx, xmlID string) (int, tc.CDNName, bool, error)

GetDSIDAndCDNFromName returns the delivery service ID and cdn name given from the delivery service name, whether a result existed, and any error.

func GetDSIDFromStaticDNSEntry

func GetDSIDFromStaticDNSEntry(tx *sql.Tx, staticDNSEntryID int) (int, error)

GetDSIDFromStaticDNSEntry returns the delivery service ID associated with the static DNS entry

func GetDSIDFromXMLID

func GetDSIDFromXMLID(tx *sql.Tx, xmlID string) (int, bool, error)

GetDSNameFromID loads the DeliveryService's xml_id from the database, from the ID. Returns whether the delivery service was found, and any error.

func GetDSNameAndCDNFromID

func GetDSNameAndCDNFromID(tx *sql.Tx, id int) (tc.DeliveryServiceName, tc.CDNName, bool, error)

returns returns the delivery service name and cdn, whether it existed, and any error.

func GetDSNameFromID

func GetDSNameFromID(tx *sql.Tx, id int) (tc.DeliveryServiceName, bool, error)

GetDSNameFromID loads the DeliveryService's xml_id from the database, from the ID. Returns whether the delivery service was found, and any error.

func GetDSRequiredCapabilitiesFromID

func GetDSRequiredCapabilitiesFromID(id int, tx *sql.Tx) ([]string, error)

GetDSRequiredCapabilitiesFromID returns the server's capabilities.

func GetDSTenantIDFromXMLID

func GetDSTenantIDFromXMLID(tx *sql.Tx, xmlid string) (int, bool, error)

GetDSTenantIDFromXMLID fetches the ID of the Tenant to whom the Delivery Service identified by the the provided XMLID belongs. It returns, in order, the requested ID (if one could be found), a boolean indicating whether or not a Delivery Service with the provided xmlid could be found, and an error for logging in case something unexpected goes wrong.

func GetDeliveryServiceCDNsByTopology

func GetDeliveryServiceCDNsByTopology(tx *sql.Tx, topology string) ([]int, error)

GetDeliveryServiceCDNsByTopology returns a slice of CDN IDs for all delivery services assigned to the given topology.

func GetDeliveryServiceTypeAndCDNName

func GetDeliveryServiceTypeAndCDNName(dsID int, tx *sql.Tx) (tc.DSType, string, bool, error)

GetDeliveryServiceTypeAndCDNName returns the type and the CDN name of the deliveryservice.

func GetDeliveryServiceTypeRequiredCapabilitiesAndTopology

func GetDeliveryServiceTypeRequiredCapabilitiesAndTopology(dsID int, tx *sql.Tx) (tc.DSType, []string, *string, bool, error)

GetDeliveryServiceTypeAndTopology returns the type of the deliveryservice and the name of its topology.

func GetDeliveryServicesWithTopologies

func GetDeliveryServicesWithTopologies(tx *sql.Tx, dsIDs []int) ([]int, error)

GetDeliveryServicesWithTopologies returns a list containing the delivery services in the given dsIDs list that have a topology assigned. An error indicates unexpected errors that occurred when querying.

func GetFederationIDForUserIDByXMLID

func GetFederationIDForUserIDByXMLID(tx *sql.Tx, userID int, xmlid string) (uint, bool, error)

GetFederationIDForUserIDByXMLID retrieves the ID of the Federation assigned to the user defined by userID on the Delivery Service identified by xmlid. If no such federation exists, the boolean returned will be 'false', while the error indicates unexpected errors that occurred when querying.

func GetFederationNameFromID

func GetFederationNameFromID(id int, tx *sql.Tx) (string, bool, error)

GetFederationNameFromID returns the federation's name, whether a federation with ID exists, or any error.

func GetFederationResolversByFederationID

func GetFederationResolversByFederationID(tx *sql.Tx, fedID int) ([]tc.FederationResolver, error)

GetFederationResolversByFederationID fetches all of the federation resolvers currently assigned to a federation. In the event of an error, it will return an empty slice and the error.

func GetGlobalParam

func GetGlobalParam(tx *sql.Tx, name string) (string, bool, error)

GetGlobalParams returns the value of the global param, whether it existed, or any error

func GetParam

func GetParam(tx *sql.Tx, name string, configFile string) (string, bool, error)

GetParam returns the value of the param, whether it existed, or any error.

func GetParamNameByID

func GetParamNameByID(tx *sql.Tx, id int) (string, bool, error)

GetParamNameByID returns the name of the param, whether it existed, or any error.

func GetPrivLevelFromRole

func GetPrivLevelFromRole(tx *sql.Tx, role string) (int, bool, error)

GetPrivLevelFromRole returns the priv_level associated with a role, whether it exists, and any error. This method exists on a temporary basis. After priv_level is fully deprecated and capabilities take over, this method will not only no longer be needed, but the corresponding new privilege check should be done via the primary database query for the users endpoint. The users json response will contain a list of capabilities in the future, whereas now the users json response currently does not contain privLevel. See the wiki page on the roles/capabilities as a system: https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=68715910

func GetPrivLevelFromRoleID

func GetPrivLevelFromRoleID(tx *sql.Tx, id int) (int, bool, error)

GetPrivLevelFromRoleID returns the priv_level associated with a role, whether it exists, and any error. This method exists on a temporary basis. After priv_level is fully deprecated and capabilities take over, this method will not only no longer be needed, but the corresponding new privilege check should be done via the primary database query for the users endpoint. The users json response will contain a list of capabilities in the future, whereas now the users json response currently does not contain privLevel. See the wiki page on the roles/capabilities as a system: https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=68715910

func GetProfileIDDesc

func GetProfileIDDesc(tx *sql.Tx, name string) (id int, desc string)

GetProfileIDDesc gets profile ID and desc for V3 servers

func GetProfileIDFromName

func GetProfileIDFromName(name string, tx *sql.Tx) (int, bool, error)

GetProfileIDFromName returns the profile's ID, whether a profile with name exists, or any error.

func GetProfileNameFromID

func GetProfileNameFromID(id int, tx *sql.Tx) (string, bool, error)

GetProfileNameFromID returns the profile's name, whether a profile with ID exists, or any error.

func GetRegionNameFromID

func GetRegionNameFromID(tx *sql.Tx, regionID int) (string, bool, error)

GetRegionNameFromID returns the name of the region associated with the supplied ID.

func GetRequiredCapabilitiesOfDeliveryServices

func GetRequiredCapabilitiesOfDeliveryServices(ids []int, tx *sql.Tx) (map[int][]string, error)

GetRequiredCapabilitiesOfDeliveryServices gets all of the required capabilities of the given delivery service IDs.

func GetRoleIDFromName

func GetRoleIDFromName(tx *sql.Tx, roleName string) (int, bool, error)

GetRoleIDFromName returns the ID of the role associated with the supplied name.

func GetServerCapabilitiesFromName

func GetServerCapabilitiesFromName(name string, tx *sql.Tx) ([]string, error)

GetServerCapabilitiesFromName returns the server's capabilities.

func GetServerCapabilitiesOfServers

func GetServerCapabilitiesOfServers(names []string, tx *sql.Tx) (map[string][]string, error)

GetServerCapabilitiesOfServers gets all of the server capabilities of the given server hostnames.

func GetServerDSNamesByCDN

func GetServerDSNamesByCDN(tx *sql.Tx, cdn string) (map[tc.CacheName][]string, error)

GetServerDSNamesByCDN returns a map of ONLINE/REPORTED/ADMIN_DOWN cache names to slice of strings which are the XML IDs of the active, non-ANYMAP delivery services to which the cache is assigned in the given CDN.

func GetServerDetailFromV4

func GetServerDetailFromV4(sd tc.ServerDetailV40, tx *sql.Tx) (tc.ServerDetail, error)

GetServerDetailFromV4 function converts server details from V4 to V3

func GetServerIDFromName

func GetServerIDFromName(serverName string, tx *sql.Tx) (int, bool, error)

GetServerIDFromName gets server id from a given name

func GetServerIDsFromCachegroupNames

func GetServerIDsFromCachegroupNames(tx *sql.Tx, cgID []string) ([]int64, error)

GetServerIDsFromCachegroupNames returns a list of servers IDs for a list of cachegroup IDs.

func GetServerInfo

func GetServerInfo(serverID int, tx *sql.Tx) (tc.ServerInfo, bool, error)

GetServerInfo returns a ServerInfo struct, whether the server exists, and an error (if one occurs).

func GetServerInfosFromHostNames

func GetServerInfosFromHostNames(tx *sql.Tx, hostNames []string) ([]tc.ServerInfo, error)

GetServerInfosFromHostNames returns the ServerInfo structs of the given server host names or an error if any occur.

func GetServerInfosFromIDs

func GetServerInfosFromIDs(tx *sql.Tx, ids []int) ([]tc.ServerInfo, error)

GetServerInfosFromIDs returns the ServerInfo structs of the given server IDs or an error if any occur.

func GetServerNameFromID

func GetServerNameFromID(tx *sql.Tx, id int64) (string, bool, error)

func GetServersInterfaces

func GetServersInterfaces(ids []int, tx *sql.Tx) (map[int]map[string]tc.ServerInterfaceInfoV40, error)

GetServerInterfaces, given the IDs of one or more servers, returns all of their network interfaces mapped by their ids, or an error if one occurs during retrieval.

func GetStatusByID

func GetStatusByID(id int, tx *sql.Tx) (tc.StatusNullable, bool, error)

GetStatusByID returns a Status struct, a bool for whether or not a status of the given ID exists, and an error (if one occurs).

func GetStatusByName

func GetStatusByName(name string, tx *sql.Tx) (tc.StatusNullable, bool, error)

GetStatusByName returns a Status struct, a bool for whether or not a status of the given name exists, and an error (if one occurs).

func GetTopologyCachegroups

func GetTopologyCachegroups(tx *sql.Tx, name string) ([]int, []string, error)

GetTopologyCachegroups returns an array of cachegroup IDs and an array of cachegroup names for the given topology, or any error.

func GetTypeIDByName

func GetTypeIDByName(t string, tx *sql.Tx) (int, bool, error)

GetTypeIDByName reports the id of the type and whether or not a type exists with the given name.

func GetUserByEmail

func GetUserByEmail(email string, tx *sql.Tx) (tc.User, bool, error)

GetUserByEmail retrieves the user with the given email. If no such user exists, the boolean returned will be 'false', while the error indicates unexpected errors that occurred when querying.

func GetUserByID

func GetUserByID(id int, tx *sql.Tx) (tc.User, bool, error)

GetUserByID returns the user with the requested ID if one exists. The second return value is a boolean indicating whether said user actually did exist, and the third contains any error encountered along the way.

func QueueRevalForServer

func QueueRevalForServer(tx *sql.Tx, serverID int64) error

QueueRevalForServer sets the revalidate update time for the server to now.

func QueueUpdateForServer

func QueueUpdateForServer(tx *sql.Tx, serverID int64) error

QueueUpdateForServer sets the config update time for the server to now.

func QueueUpdateForServerWithCachegroupCDN

func QueueUpdateForServerWithCachegroupCDN(tx *sql.Tx, cgID int, cdnID int64) ([]tc.CacheName, error)

QueueUpdateForServerWithCachegroupCDN sets the config update time for all servers belonging to the specified cachegroup (id) and cdn (id).

func QueueUpdateForServerWithTopologyCDN

func QueueUpdateForServerWithTopologyCDN(tx *sql.Tx, topologyName tc.TopologyName, cdnId int64) error

QueueUpdateForServerWithTopologyCDN sets the config update time for all servers within the specific topology (name) and cdn (id).

func RoleExists

func RoleExists(tx *sql.Tx, roleID int) (bool, error)

RoleExists returns whether or not the role with the given roleName exists, and any error that occurred.

func ScanCachegroupsServerCapabilities

func ScanCachegroupsServerCapabilities(rows *sql.Rows) (map[string][]int, map[int]map[string]struct{}, map[int]int, error)

ScanCachegroupsServerCapabilities, given rows of (server ID, CDN ID, cachegroup name, server capabilities), returns a map of cachegroup names to server IDs, a map of server IDs to a map of their capabilities, a map of server IDs to CDN IDs, and an error (if one occurs).

func SetApplyRevalForServer

func SetApplyRevalForServer(tx *sql.Tx, serverID int64) error

SetApplyRevalForServer sets the revalidate apply time for the server to now.

func SetApplyRevalForServerWithTime

func SetApplyRevalForServerWithTime(tx *sql.Tx, serverID int64, applyRevalTime time.Time) error

SetApplyRevalForServerWithTime sets the revalidate apply time for the server to the provided time.

func SetApplyUpdateForServer

func SetApplyUpdateForServer(tx *sql.Tx, serverID int64) error

SetApplyUpdateForServer sets the config apply time for the server to now.

func SetApplyUpdateForServerWithTime

func SetApplyUpdateForServerWithTime(tx *sql.Tx, serverID int64, applyUpdateTime time.Time) error

SetApplyUpdateForServerWithTime sets the config apply time for the server to the provided time.

func TopologyExists

func TopologyExists(tx *sql.Tx, name string) (bool, error)

TopologyExists checks if a Topology with the given name exists. Returns whether or not the Topology exists, along with any encountered error.

func UpdateServerProfileTableForV3

func UpdateServerProfileTableForV3(id *int, newProfileId *int, origProfile string, tx *sql.Tx) error

UpdateServerProfileTableForV3 updates CommonServerPropertiesV40 struct and server_profile table via Update (server) function for API v3.

func UpdateServerProfilesForV4

func UpdateServerProfilesForV4(id int, profile []string, tx *sql.Tx) error

UpdateServerProfilesForV4 updates server_profile table via update function for APIv4.

func UsernameExists

func UsernameExists(uname string, tx *sql.Tx) (bool, error)

UsernameExists reports whether or not the the given username exists as a user in the database to which the passed transaction refers. If anything goes wrong when checking the existence of said user, the error is directly returned to the caller. Note that in that case, no real meaning should be assigned to the returned boolean value.

Types

type WhereColumnInfo

type WhereColumnInfo struct {
	Column  string
	Checker func(string) error
}

Jump to

Keyboard shortcuts

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