github.com/blend/go-sdk@v1.20220411.3/configutil/float64_ptr.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  // Float64Ptr returns an Float64Source for a given float64 pointer.
    13  func Float64Ptr(value *float64) Float64Source {
    14  	return Float64PtrSource{Value: value}
    15  }
    16  
    17  var (
    18  	_ Float64Source = (*Float64PtrSource)(nil)
    19  )
    20  
    21  // Float64PtrSource is a Float64Source that wraps a float64 pointer.
    22  type Float64PtrSource struct {
    23  	Value *float64
    24  }
    25  
    26  // Float64 implements Float64Source.
    27  func (fps Float64PtrSource) Float64(_ context.Context) (*float64, error) {
    28  	return fps.Value, nil
    29  }