github.com/hashgraph/hedera-sdk-go/v2@v2.48.0/semantic_version.go (about)

     1  package hedera
     2  
     3  /*-
     4   *
     5   * Hedera Go SDK
     6   *
     7   * Copyright (C) 2020 - 2024 Hedera Hashgraph, LLC
     8   *
     9   * Licensed under the Apache License, Version 2.0 (the "License");
    10   * you may not use this file except in compliance with the License.
    11   * You may obtain a copy of the License at
    12   *
    13   *      http://www.apache.org/licenses/LICENSE-2.0
    14   *
    15   * Unless required by applicable law or agreed to in writing, software
    16   * distributed under the License is distributed on an "AS IS" BASIS,
    17   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    18   * See the License for the specific language governing permissions and
    19   * limitations under the License.
    20   *
    21   */
    22  
    23  import (
    24  	"github.com/hashgraph/hedera-protobufs-go/services"
    25  )
    26  
    27  type SemanticVersion struct {
    28  	Major uint32
    29  	Minor uint32
    30  	Patch uint32
    31  	Pre   string
    32  	Build string
    33  }
    34  
    35  func _SemanticVersionFromProtobuf(version *services.SemanticVersion) SemanticVersion {
    36  	if version == nil {
    37  		return SemanticVersion{}
    38  	}
    39  	return SemanticVersion{
    40  		Major: uint32(version.GetMajor()),
    41  		Minor: uint32(version.GetMinor()),
    42  		Patch: uint32(version.GetPatch()),
    43  		Pre:   version.GetPre(),
    44  		Build: version.GetBuild(),
    45  	}
    46  }
    47  
    48  func (version *SemanticVersion) _ToProtobuf() *services.SemanticVersion {
    49  	return &services.SemanticVersion{
    50  		Major: int32(version.Major),
    51  		Minor: int32(version.Minor),
    52  		Patch: int32(version.Patch),
    53  		Pre:   version.Pre,
    54  		Build: version.Build,
    55  	}
    56  }