MCPcopy Create free account
hub / github.com/dolthub/doltgresql / FindInvalidIdentifiers

Function FindInvalidIdentifiers

core/extensions/extensions.go:124–164  ·  view source on GitHub ↗

FindInvalidIdentifiers returns all identifiers that are not valid for the current environment. If the return is empty, then that means all of the given identifiers are valid.

(identifiers ...LibraryIdentifier)

Source from the content-addressed store, hash-verified

122// FindInvalidIdentifiers returns all identifiers that are not valid for the current environment. If the return is
123// empty, then that means all of the given identifiers are valid.
124func FindInvalidIdentifiers(identifiers ...LibraryIdentifier) []InvalidIdentifier {
125 extMutex.Lock()
126 defer extMutex.Unlock()
127
128 var invalidIdentifiers []InvalidIdentifier
129 if cachedError != nil {
130 invalidIdentifiers = make([]InvalidIdentifier, 0, len(identifiers))
131 for _, identifier := range identifiers {
132 invalidIdentifiers = append(invalidIdentifiers, InvalidIdentifier{
133 Identifier: identifier,
134 Reason: InvalidIdentifierReason_MissingLibrary,
135 })
136 }
137 return invalidIdentifiers
138 }
139 for _, identifier := range identifiers {
140 if identifier.Platform() != pg_extension.PLATFORM {
141 invalidIdentifiers = append(invalidIdentifiers, InvalidIdentifier{
142 Identifier: identifier,
143 Reason: InvalidIdentifierReason_MismatchedPlatform,
144 })
145 continue
146 }
147 ext, ok := allExtensions[identifier.ExtensionName()]
148 if !ok {
149 invalidIdentifiers = append(invalidIdentifiers, InvalidIdentifier{
150 Identifier: identifier,
151 Reason: InvalidIdentifierReason_MissingLibrary,
152 })
153 continue
154 }
155 if ext.Control.DefaultVersion != identifier.Version() {
156 invalidIdentifiers = append(invalidIdentifiers, InvalidIdentifier{
157 Identifier: identifier,
158 Reason: InvalidIdentifierReason_InvalidVersion,
159 })
160 continue
161 }
162 }
163 return invalidIdentifiers
164}
165
166// GetPlatform returns the current platform that Doltgres is being executed on. This is encoded as a three-letter string.
167func GetPlatform() string {

Callers

nothing calls this directly

Calls 5

LockMethod · 0.80
UnlockMethod · 0.80
PlatformMethod · 0.80
ExtensionNameMethod · 0.80
VersionMethod · 0.45

Tested by

no test coverage detected