github.com/blend/go-sdk@v1.20220411.3/configutil/int32_ptr_source.go (about)

     1  /*
     2  
     3  Copyright (c) 2022 - Present. Blend Labs, Inc. All rights reserved
     4  Use of this source code is governed by a MIT license that can be found in the LICENSE file.
     5  
     6  */
     7  
     8  package configutil
     9  
    10  import "context"
    11  
    12  // Int32Ptr returns an Int32Source for a given int32 pointer.
    13  func Int32Ptr(value *int32) Int32Source {
    14  	return Int32PtrSource{Value: value}
    15  }
    16  
    17  var (
    18  	_ Int32Source = (*Int32PtrSource)(nil)
    19  )
    20  
    21  // Int32PtrSource is a Int32Source that wraps an int32 pointer.
    22  type Int32PtrSource struct {
    23  	Value *int32
    24  }
    25  
    26  // Int32 implements Int32Source.
    27  func (ips Int32PtrSource) Int32(_ context.Context) (*int32, error) {
    28  	return ips.Value, nil
    29  }