github.com/blend/go-sdk@v1.20220411.3/configutil/int64.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  var (
    13  	_ Int64Source = (*Int64)(nil)
    14  )
    15  
    16  // Int64 implements value provider.
    17  //
    18  // Note: Int64 treats 0 as unset, if 0 is a valid value you must use configutil.Int64Ptr.
    19  type Int64 int64
    20  
    21  // Int64 returns the value for a constant.
    22  func (i Int64) Int64(_ context.Context) (*int64, error) {
    23  	if i > 0 {
    24  		value := int64(i)
    25  		return &value, nil
    26  	}
    27  	return nil, nil
    28  }