1 // pubsubplus-go-client 2 // 3 // Copyright 2021-2024 Solace Corporation. All rights reserved. 4 // 5 // Licensed under the Apache License, Version 2.0 (the "License"); 6 // you may not use this file except in compliance with the License. 7 // You may obtain a copy of the License at 8 // 9 // http://www.apache.org/licenses/LICENSE-2.0 10 // 11 // Unless required by applicable law or agreed to in writing, software 12 // distributed under the License is distributed on an "AS IS" BASIS, 13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 // See the License for the specific language governing permissions and 15 // limitations under the License. 16 17 // Package subcode contains the subcodes returned from the Solace PubSub+ Messaging API for C. 18 // The subcodes are generated in subcode_generated.go. This is an advanced feature and should 19 // be used only when absolutely necessary. 20 package subcode 21 22 import "solace.dev/go/messaging/internal/ccsmp" 23 24 //go:generate go run subcode_generator.go $SOLCLIENT_H 25 26 // Code represents the various subcodes that can be returned as part of SolClientError. 27 type Code int 28 29 // Is checks if the given Code equals any of the entries. 30 func Is(subCode Code, entries ...Code) bool { 31 for _, entry := range entries { 32 if entry == subCode { 33 return true 34 } 35 } 36 return false 37 } 38 39 // String returns the subcode as a string value. 40 func (code Code) String() string { 41 return ccsmp.SolClientSubCodeToString(ccsmp.SolClientSubCode(code)) 42 } 43