123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596 |
- package swag
-
- import "time"
-
- // This file was taken from the aws go sdk
-
- // String returns a pointer to of the string value passed in.
- func String(v string) *string {
- return &v
- }
-
- // StringValue returns the value of the string pointer passed in or
- // "" if the pointer is nil.
- func StringValue(v *string) string {
- if v != nil {
- return *v
- }
- return ""
- }
-
- // StringSlice converts a slice of string values into a slice of
- // string pointers
- func StringSlice(src []string) []*string {
- dst := make([]*string, len(src))
- for i := 0; i < len(src); i++ {
- dst[i] = &(src[i])
- }
- return dst
- }
-
- // StringValueSlice converts a slice of string pointers into a slice of
- // string values
- func StringValueSlice(src []*string) []string {
- dst := make([]string, len(src))
- for i := 0; i < len(src); i++ {
- if src[i] != nil {
- dst[i] = *(src[i])
- }
- }
- return dst
- }
-
- // StringMap converts a string map of string values into a string
- // map of string pointers
- func StringMap(src map[string]string) map[string]*string {
- dst := make(map[string]*string)
- for k, val := range src {
- v := val
- dst[k] = &v
- }
- return dst
- }
-
- // StringValueMap converts a string map of string pointers into a string
- // map of string values
- func StringValueMap(src map[string]*string) map[string]string {
- dst := make(map[string]string)
- for k, val := range src {
- if val != nil {
- dst[k] = *val
- }
- }
- return dst
- }
-
- // Bool returns a pointer to of the bool value passed in.
- func Bool(v bool) *bool {
- return &v
- }
-
- // BoolValue returns the value of the bool pointer passed in or
- // false if the pointer is nil.
- func BoolValue(v *bool) bool {
- if v != nil {
- return *v
- }
- return false
- }
-
- // BoolSlice converts a slice of bool values into a slice of
- // bool pointers
- func BoolSlice(src []bool) []*bool {
- dst := make([]*bool, len(src))
- for i := 0; i < len(src); i++ {
- dst[i] = &(src[i])
- }
- return dst
- }
-
- // BoolValueSlice converts a slice of bool pointers into a slice of
- // bool values
- func BoolValueSlice(src []*bool) []bool {
- dst := make([]bool, len(src))
- for i := 0; i < len(src); i++ {
- if src[i] != nil {
- dst[i] = *(src[i])
- }
- }
- return dst
- }
-
- // BoolMap converts a string map of bool values into a string
- // map of bool pointers
- func BoolMap(src map[string]bool) map[string]*bool {
- dst := make(map[string]*bool)
- for k, val := range src {
- v := val
- dst[k] = &v
- }
- return dst
- }
-
- // BoolValueMap converts a string map of bool pointers into a string
- // map of bool values
- func BoolValueMap(src map[string]*bool) map[string]bool {
- dst := make(map[string]bool)
- for k, val := range src {
- if val != nil {
- dst[k] = *val
- }
- }
- return dst
- }
-
- // Int returns a pointer to of the int value passed in.
- func Int(v int) *int {
- return &v
- }
-
- // IntValue returns the value of the int pointer passed in or
- // 0 if the pointer is nil.
- func IntValue(v *int) int {
- if v != nil {
- return *v
- }
- return 0
- }
-
- // IntSlice converts a slice of int values into a slice of
- // int pointers
- func IntSlice(src []int) []*int {
- dst := make([]*int, len(src))
- for i := 0; i < len(src); i++ {
- dst[i] = &(src[i])
- }
- return dst
- }
-
- // IntValueSlice converts a slice of int pointers into a slice of
- // int values
- func IntValueSlice(src []*int) []int {
- dst := make([]int, len(src))
- for i := 0; i < len(src); i++ {
- if src[i] != nil {
- dst[i] = *(src[i])
- }
- }
- return dst
- }
-
- // IntMap converts a string map of int values into a string
- // map of int pointers
- func IntMap(src map[string]int) map[string]*int {
- dst := make(map[string]*int)
- for k, val := range src {
- v := val
- dst[k] = &v
- }
- return dst
- }
-
- // IntValueMap converts a string map of int pointers into a string
- // map of int values
- func IntValueMap(src map[string]*int) map[string]int {
- dst := make(map[string]int)
- for k, val := range src {
- if val != nil {
- dst[k] = *val
- }
- }
- return dst
- }
-
- // Int32 returns a pointer to of the int64 value passed in.
- func Int32(v int32) *int32 {
- return &v
- }
-
- // Int32Value returns the value of the int64 pointer passed in or
- // 0 if the pointer is nil.
- func Int32Value(v *int32) int32 {
- if v != nil {
- return *v
- }
- return 0
- }
-
- // Int32Slice converts a slice of int64 values into a slice of
- // int32 pointers
- func Int32Slice(src []int32) []*int32 {
- dst := make([]*int32, len(src))
- for i := 0; i < len(src); i++ {
- dst[i] = &(src[i])
- }
- return dst
- }
-
- // Int32ValueSlice converts a slice of int32 pointers into a slice of
- // int32 values
- func Int32ValueSlice(src []*int32) []int32 {
- dst := make([]int32, len(src))
- for i := 0; i < len(src); i++ {
- if src[i] != nil {
- dst[i] = *(src[i])
- }
- }
- return dst
- }
-
- // Int32Map converts a string map of int32 values into a string
- // map of int32 pointers
- func Int32Map(src map[string]int32) map[string]*int32 {
- dst := make(map[string]*int32)
- for k, val := range src {
- v := val
- dst[k] = &v
- }
- return dst
- }
-
- // Int32ValueMap converts a string map of int32 pointers into a string
- // map of int32 values
- func Int32ValueMap(src map[string]*int32) map[string]int32 {
- dst := make(map[string]int32)
- for k, val := range src {
- if val != nil {
- dst[k] = *val
- }
- }
- return dst
- }
-
- // Int64 returns a pointer to of the int64 value passed in.
- func Int64(v int64) *int64 {
- return &v
- }
-
- // Int64Value returns the value of the int64 pointer passed in or
- // 0 if the pointer is nil.
- func Int64Value(v *int64) int64 {
- if v != nil {
- return *v
- }
- return 0
- }
-
- // Int64Slice converts a slice of int64 values into a slice of
- // int64 pointers
- func Int64Slice(src []int64) []*int64 {
- dst := make([]*int64, len(src))
- for i := 0; i < len(src); i++ {
- dst[i] = &(src[i])
- }
- return dst
- }
-
- // Int64ValueSlice converts a slice of int64 pointers into a slice of
- // int64 values
- func Int64ValueSlice(src []*int64) []int64 {
- dst := make([]int64, len(src))
- for i := 0; i < len(src); i++ {
- if src[i] != nil {
- dst[i] = *(src[i])
- }
- }
- return dst
- }
-
- // Int64Map converts a string map of int64 values into a string
- // map of int64 pointers
- func Int64Map(src map[string]int64) map[string]*int64 {
- dst := make(map[string]*int64)
- for k, val := range src {
- v := val
- dst[k] = &v
- }
- return dst
- }
-
- // Int64ValueMap converts a string map of int64 pointers into a string
- // map of int64 values
- func Int64ValueMap(src map[string]*int64) map[string]int64 {
- dst := make(map[string]int64)
- for k, val := range src {
- if val != nil {
- dst[k] = *val
- }
- }
- return dst
- }
-
- // Uint returns a pouinter to of the uint value passed in.
- func Uint(v uint) *uint {
- return &v
- }
-
- // UintValue returns the value of the uint pouinter passed in or
- // 0 if the pouinter is nil.
- func UintValue(v *uint) uint {
- if v != nil {
- return *v
- }
- return 0
- }
-
- // UintSlice converts a slice of uint values uinto a slice of
- // uint pouinters
- func UintSlice(src []uint) []*uint {
- dst := make([]*uint, len(src))
- for i := 0; i < len(src); i++ {
- dst[i] = &(src[i])
- }
- return dst
- }
-
- // UintValueSlice converts a slice of uint pouinters uinto a slice of
- // uint values
- func UintValueSlice(src []*uint) []uint {
- dst := make([]uint, len(src))
- for i := 0; i < len(src); i++ {
- if src[i] != nil {
- dst[i] = *(src[i])
- }
- }
- return dst
- }
-
- // UintMap converts a string map of uint values uinto a string
- // map of uint pouinters
- func UintMap(src map[string]uint) map[string]*uint {
- dst := make(map[string]*uint)
- for k, val := range src {
- v := val
- dst[k] = &v
- }
- return dst
- }
-
- // UintValueMap converts a string map of uint pouinters uinto a string
- // map of uint values
- func UintValueMap(src map[string]*uint) map[string]uint {
- dst := make(map[string]uint)
- for k, val := range src {
- if val != nil {
- dst[k] = *val
- }
- }
- return dst
- }
-
- // Uint32 returns a pouinter to of the uint64 value passed in.
- func Uint32(v uint32) *uint32 {
- return &v
- }
-
- // Uint32Value returns the value of the uint64 pouinter passed in or
- // 0 if the pouinter is nil.
- func Uint32Value(v *uint32) uint32 {
- if v != nil {
- return *v
- }
- return 0
- }
-
- // Uint32Slice converts a slice of uint64 values uinto a slice of
- // uint32 pouinters
- func Uint32Slice(src []uint32) []*uint32 {
- dst := make([]*uint32, len(src))
- for i := 0; i < len(src); i++ {
- dst[i] = &(src[i])
- }
- return dst
- }
-
- // Uint32ValueSlice converts a slice of uint32 pouinters uinto a slice of
- // uint32 values
- func Uint32ValueSlice(src []*uint32) []uint32 {
- dst := make([]uint32, len(src))
- for i := 0; i < len(src); i++ {
- if src[i] != nil {
- dst[i] = *(src[i])
- }
- }
- return dst
- }
-
- // Uint32Map converts a string map of uint32 values uinto a string
- // map of uint32 pouinters
- func Uint32Map(src map[string]uint32) map[string]*uint32 {
- dst := make(map[string]*uint32)
- for k, val := range src {
- v := val
- dst[k] = &v
- }
- return dst
- }
-
- // Uint32ValueMap converts a string map of uint32 pouinters uinto a string
- // map of uint32 values
- func Uint32ValueMap(src map[string]*uint32) map[string]uint32 {
- dst := make(map[string]uint32)
- for k, val := range src {
- if val != nil {
- dst[k] = *val
- }
- }
- return dst
- }
-
- // Uint64 returns a pouinter to of the uint64 value passed in.
- func Uint64(v uint64) *uint64 {
- return &v
- }
-
- // Uint64Value returns the value of the uint64 pouinter passed in or
- // 0 if the pouinter is nil.
- func Uint64Value(v *uint64) uint64 {
- if v != nil {
- return *v
- }
- return 0
- }
-
- // Uint64Slice converts a slice of uint64 values uinto a slice of
- // uint64 pouinters
- func Uint64Slice(src []uint64) []*uint64 {
- dst := make([]*uint64, len(src))
- for i := 0; i < len(src); i++ {
- dst[i] = &(src[i])
- }
- return dst
- }
-
- // Uint64ValueSlice converts a slice of uint64 pouinters uinto a slice of
- // uint64 values
- func Uint64ValueSlice(src []*uint64) []uint64 {
- dst := make([]uint64, len(src))
- for i := 0; i < len(src); i++ {
- if src[i] != nil {
- dst[i] = *(src[i])
- }
- }
- return dst
- }
-
- // Uint64Map converts a string map of uint64 values uinto a string
- // map of uint64 pouinters
- func Uint64Map(src map[string]uint64) map[string]*uint64 {
- dst := make(map[string]*uint64)
- for k, val := range src {
- v := val
- dst[k] = &v
- }
- return dst
- }
-
- // Uint64ValueMap converts a string map of uint64 pouinters uinto a string
- // map of uint64 values
- func Uint64ValueMap(src map[string]*uint64) map[string]uint64 {
- dst := make(map[string]uint64)
- for k, val := range src {
- if val != nil {
- dst[k] = *val
- }
- }
- return dst
- }
-
- // Float64 returns a pointer to of the float64 value passed in.
- func Float64(v float64) *float64 {
- return &v
- }
-
- // Float64Value returns the value of the float64 pointer passed in or
- // 0 if the pointer is nil.
- func Float64Value(v *float64) float64 {
- if v != nil {
- return *v
- }
- return 0
- }
-
- // Float64Slice converts a slice of float64 values into a slice of
- // float64 pointers
- func Float64Slice(src []float64) []*float64 {
- dst := make([]*float64, len(src))
- for i := 0; i < len(src); i++ {
- dst[i] = &(src[i])
- }
- return dst
- }
-
- // Float64ValueSlice converts a slice of float64 pointers into a slice of
- // float64 values
- func Float64ValueSlice(src []*float64) []float64 {
- dst := make([]float64, len(src))
- for i := 0; i < len(src); i++ {
- if src[i] != nil {
- dst[i] = *(src[i])
- }
- }
- return dst
- }
-
- // Float64Map converts a string map of float64 values into a string
- // map of float64 pointers
- func Float64Map(src map[string]float64) map[string]*float64 {
- dst := make(map[string]*float64)
- for k, val := range src {
- v := val
- dst[k] = &v
- }
- return dst
- }
-
- // Float64ValueMap converts a string map of float64 pointers into a string
- // map of float64 values
- func Float64ValueMap(src map[string]*float64) map[string]float64 {
- dst := make(map[string]float64)
- for k, val := range src {
- if val != nil {
- dst[k] = *val
- }
- }
- return dst
- }
-
- // Time returns a pointer to of the time.Time value passed in.
- func Time(v time.Time) *time.Time {
- return &v
- }
-
- // TimeValue returns the value of the time.Time pointer passed in or
- // time.Time{} if the pointer is nil.
- func TimeValue(v *time.Time) time.Time {
- if v != nil {
- return *v
- }
- return time.Time{}
- }
-
- // TimeSlice converts a slice of time.Time values into a slice of
- // time.Time pointers
- func TimeSlice(src []time.Time) []*time.Time {
- dst := make([]*time.Time, len(src))
- for i := 0; i < len(src); i++ {
- dst[i] = &(src[i])
- }
- return dst
- }
-
- // TimeValueSlice converts a slice of time.Time pointers into a slice of
- // time.Time values
- func TimeValueSlice(src []*time.Time) []time.Time {
- dst := make([]time.Time, len(src))
- for i := 0; i < len(src); i++ {
- if src[i] != nil {
- dst[i] = *(src[i])
- }
- }
- return dst
- }
-
- // TimeMap converts a string map of time.Time values into a string
- // map of time.Time pointers
- func TimeMap(src map[string]time.Time) map[string]*time.Time {
- dst := make(map[string]*time.Time)
- for k, val := range src {
- v := val
- dst[k] = &v
- }
- return dst
- }
-
- // TimeValueMap converts a string map of time.Time pointers into a string
- // map of time.Time values
- func TimeValueMap(src map[string]*time.Time) map[string]time.Time {
- dst := make(map[string]time.Time)
- for k, val := range src {
- if val != nil {
- dst[k] = *val
- }
- }
- return dst
- }
|