github.com/patricebensoussan/go/codec@v1.2.99/sort-slice.generated.go (about)

     1  // Copyright (c) 2012-2020 Ugorji Nwoke. All rights reserved.
     2  // Use of this source code is governed by a MIT license found in the LICENSE file.
     3  
     4  // Code generated from sort-slice.go.tmpl - DO NOT EDIT.
     5  
     6  package codec
     7  
     8  import "time"
     9  import "reflect"
    10  import "bytes"
    11  
    12  type stringSlice []string
    13  
    14  func (p stringSlice) Len() int      { return len(p) }
    15  func (p stringSlice) Swap(i, j int) { p[uint(i)], p[uint(j)] = p[uint(j)], p[uint(i)] }
    16  func (p stringSlice) Less(i, j int) bool {
    17  	return p[uint(i)] < p[uint(j)]
    18  }
    19  
    20  type uint8Slice []uint8
    21  
    22  func (p uint8Slice) Len() int      { return len(p) }
    23  func (p uint8Slice) Swap(i, j int) { p[uint(i)], p[uint(j)] = p[uint(j)], p[uint(i)] }
    24  func (p uint8Slice) Less(i, j int) bool {
    25  	return p[uint(i)] < p[uint(j)]
    26  }
    27  
    28  type uint64Slice []uint64
    29  
    30  func (p uint64Slice) Len() int      { return len(p) }
    31  func (p uint64Slice) Swap(i, j int) { p[uint(i)], p[uint(j)] = p[uint(j)], p[uint(i)] }
    32  func (p uint64Slice) Less(i, j int) bool {
    33  	return p[uint(i)] < p[uint(j)]
    34  }
    35  
    36  type intSlice []int
    37  
    38  func (p intSlice) Len() int      { return len(p) }
    39  func (p intSlice) Swap(i, j int) { p[uint(i)], p[uint(j)] = p[uint(j)], p[uint(i)] }
    40  func (p intSlice) Less(i, j int) bool {
    41  	return p[uint(i)] < p[uint(j)]
    42  }
    43  
    44  type int32Slice []int32
    45  
    46  func (p int32Slice) Len() int      { return len(p) }
    47  func (p int32Slice) Swap(i, j int) { p[uint(i)], p[uint(j)] = p[uint(j)], p[uint(i)] }
    48  func (p int32Slice) Less(i, j int) bool {
    49  	return p[uint(i)] < p[uint(j)]
    50  }
    51  
    52  type stringRv struct {
    53  	v string
    54  	r reflect.Value
    55  }
    56  type stringRvSlice []stringRv
    57  
    58  func (p stringRvSlice) Len() int      { return len(p) }
    59  func (p stringRvSlice) Swap(i, j int) { p[uint(i)], p[uint(j)] = p[uint(j)], p[uint(i)] }
    60  func (p stringRvSlice) Less(i, j int) bool {
    61  	return p[uint(i)].v < p[uint(j)].v
    62  }
    63  
    64  type stringIntf struct {
    65  	v string
    66  	i interface{}
    67  }
    68  type stringIntfSlice []stringIntf
    69  
    70  func (p stringIntfSlice) Len() int      { return len(p) }
    71  func (p stringIntfSlice) Swap(i, j int) { p[uint(i)], p[uint(j)] = p[uint(j)], p[uint(i)] }
    72  func (p stringIntfSlice) Less(i, j int) bool {
    73  	return p[uint(i)].v < p[uint(j)].v
    74  }
    75  
    76  type float64Rv struct {
    77  	v float64
    78  	r reflect.Value
    79  }
    80  type float64RvSlice []float64Rv
    81  
    82  func (p float64RvSlice) Len() int      { return len(p) }
    83  func (p float64RvSlice) Swap(i, j int) { p[uint(i)], p[uint(j)] = p[uint(j)], p[uint(i)] }
    84  func (p float64RvSlice) Less(i, j int) bool {
    85  	return p[uint(i)].v < p[uint(j)].v || isNaN64(p[uint(i)].v) && !isNaN64(p[uint(j)].v)
    86  }
    87  
    88  type uint64Rv struct {
    89  	v uint64
    90  	r reflect.Value
    91  }
    92  type uint64RvSlice []uint64Rv
    93  
    94  func (p uint64RvSlice) Len() int      { return len(p) }
    95  func (p uint64RvSlice) Swap(i, j int) { p[uint(i)], p[uint(j)] = p[uint(j)], p[uint(i)] }
    96  func (p uint64RvSlice) Less(i, j int) bool {
    97  	return p[uint(i)].v < p[uint(j)].v
    98  }
    99  
   100  type int64Rv struct {
   101  	v int64
   102  	r reflect.Value
   103  }
   104  type int64RvSlice []int64Rv
   105  
   106  func (p int64RvSlice) Len() int      { return len(p) }
   107  func (p int64RvSlice) Swap(i, j int) { p[uint(i)], p[uint(j)] = p[uint(j)], p[uint(i)] }
   108  func (p int64RvSlice) Less(i, j int) bool {
   109  	return p[uint(i)].v < p[uint(j)].v
   110  }
   111  
   112  type boolRv struct {
   113  	v bool
   114  	r reflect.Value
   115  }
   116  type boolRvSlice []boolRv
   117  
   118  func (p boolRvSlice) Len() int      { return len(p) }
   119  func (p boolRvSlice) Swap(i, j int) { p[uint(i)], p[uint(j)] = p[uint(j)], p[uint(i)] }
   120  func (p boolRvSlice) Less(i, j int) bool {
   121  	return !p[uint(i)].v && p[uint(j)].v
   122  }
   123  
   124  type timeRv struct {
   125  	v time.Time
   126  	r reflect.Value
   127  }
   128  type timeRvSlice []timeRv
   129  
   130  func (p timeRvSlice) Len() int      { return len(p) }
   131  func (p timeRvSlice) Swap(i, j int) { p[uint(i)], p[uint(j)] = p[uint(j)], p[uint(i)] }
   132  func (p timeRvSlice) Less(i, j int) bool {
   133  	return p[uint(i)].v.Before(p[uint(j)].v)
   134  }
   135  
   136  type bytesRv struct {
   137  	v []byte
   138  	r reflect.Value
   139  }
   140  type bytesRvSlice []bytesRv
   141  
   142  func (p bytesRvSlice) Len() int      { return len(p) }
   143  func (p bytesRvSlice) Swap(i, j int) { p[uint(i)], p[uint(j)] = p[uint(j)], p[uint(i)] }
   144  func (p bytesRvSlice) Less(i, j int) bool {
   145  	return bytes.Compare(p[uint(i)].v, p[uint(j)].v) == -1
   146  }
   147  
   148  type bytesIntf struct {
   149  	v []byte
   150  	i interface{}
   151  }
   152  type bytesIntfSlice []bytesIntf
   153  
   154  func (p bytesIntfSlice) Len() int      { return len(p) }
   155  func (p bytesIntfSlice) Swap(i, j int) { p[uint(i)], p[uint(j)] = p[uint(j)], p[uint(i)] }
   156  func (p bytesIntfSlice) Less(i, j int) bool {
   157  	return bytes.Compare(p[uint(i)].v, p[uint(j)].v) == -1
   158  }