github.com/lbryio/lbcd@v0.22.119/btcjson/helpers.go (about) 1 // Copyright (c) 2014 The btcsuite developers 2 // Use of this source code is governed by an ISC 3 // license that can be found in the LICENSE file. 4 5 package btcjson 6 7 // Bool is a helper routine that allocates a new bool value to store v and 8 // returns a pointer to it. This is useful when assigning optional parameters. 9 func Bool(v bool) *bool { 10 p := new(bool) 11 *p = v 12 return p 13 } 14 15 // Int is a helper routine that allocates a new int value to store v and 16 // returns a pointer to it. This is useful when assigning optional parameters. 17 func Int(v int) *int { 18 p := new(int) 19 *p = v 20 return p 21 } 22 23 // Uint is a helper routine that allocates a new uint value to store v and 24 // returns a pointer to it. This is useful when assigning optional parameters. 25 func Uint(v uint) *uint { 26 p := new(uint) 27 *p = v 28 return p 29 } 30 31 // Int32 is a helper routine that allocates a new int32 value to store v and 32 // returns a pointer to it. This is useful when assigning optional parameters. 33 func Int32(v int32) *int32 { 34 p := new(int32) 35 *p = v 36 return p 37 } 38 39 // Uint32 is a helper routine that allocates a new uint32 value to store v and 40 // returns a pointer to it. This is useful when assigning optional parameters. 41 func Uint32(v uint32) *uint32 { 42 p := new(uint32) 43 *p = v 44 return p 45 } 46 47 // Int64 is a helper routine that allocates a new int64 value to store v and 48 // returns a pointer to it. This is useful when assigning optional parameters. 49 func Int64(v int64) *int64 { 50 p := new(int64) 51 *p = v 52 return p 53 } 54 55 // Uint64 is a helper routine that allocates a new uint64 value to store v and 56 // returns a pointer to it. This is useful when assigning optional parameters. 57 func Uint64(v uint64) *uint64 { 58 p := new(uint64) 59 *p = v 60 return p 61 } 62 63 // Float64 is a helper routine that allocates a new float64 value to store v and 64 // returns a pointer to it. This is useful when assigning optional parameters. 65 func Float64(v float64) *float64 { 66 p := new(float64) 67 *p = v 68 return p 69 } 70 71 // String is a helper routine that allocates a new string value to store v and 72 // returns a pointer to it. This is useful when assigning optional parameters. 73 func String(v string) *string { 74 p := new(string) 75 *p = v 76 return p 77 } 78 79 // NewFilterTypeName is a helper routine that allocates a new FilterTypeName value to store v and 80 // returns a pointer to it. This is useful when assigning optional parameters. 81 func NewFilterTypeName(v FilterTypeName) *FilterTypeName { 82 p := new(FilterTypeName) 83 *p = v 84 return p 85 }