github.com/ugorji/go/codec@v1.2.13-0.20240307214044-07c54c229a5a/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 (
     9  	"bytes"
    10  	"reflect"
    11  	"time"
    12  )
    13  
    14  type stringSlice []string
    15  
    16  func (p stringSlice) Len() int      { return len(p) }
    17  func (p stringSlice) Swap(i, j int) { p[uint(i)], p[uint(j)] = p[uint(j)], p[uint(i)] }
    18  func (p stringSlice) Less(i, j int) bool {
    19  	return p[uint(i)] < p[uint(j)]
    20  }
    21  
    22  type uint8Slice []uint8
    23  
    24  func (p uint8Slice) Len() int      { return len(p) }
    25  func (p uint8Slice) Swap(i, j int) { p[uint(i)], p[uint(j)] = p[uint(j)], p[uint(i)] }
    26  func (p uint8Slice) Less(i, j int) bool {
    27  	return p[uint(i)] < p[uint(j)]
    28  }
    29  
    30  type uint64Slice []uint64
    31  
    32  func (p uint64Slice) Len() int      { return len(p) }
    33  func (p uint64Slice) Swap(i, j int) { p[uint(i)], p[uint(j)] = p[uint(j)], p[uint(i)] }
    34  func (p uint64Slice) Less(i, j int) bool {
    35  	return p[uint(i)] < p[uint(j)]
    36  }
    37  
    38  type intSlice []int
    39  
    40  func (p intSlice) Len() int      { return len(p) }
    41  func (p intSlice) Swap(i, j int) { p[uint(i)], p[uint(j)] = p[uint(j)], p[uint(i)] }
    42  func (p intSlice) Less(i, j int) bool {
    43  	return p[uint(i)] < p[uint(j)]
    44  }
    45  
    46  type int32Slice []int32
    47  
    48  func (p int32Slice) Len() int      { return len(p) }
    49  func (p int32Slice) Swap(i, j int) { p[uint(i)], p[uint(j)] = p[uint(j)], p[uint(i)] }
    50  func (p int32Slice) Less(i, j int) bool {
    51  	return p[uint(i)] < p[uint(j)]
    52  }
    53  
    54  type stringRv struct {
    55  	v string
    56  	r reflect.Value
    57  }
    58  type stringRvSlice []stringRv
    59  
    60  func (p stringRvSlice) Len() int      { return len(p) }
    61  func (p stringRvSlice) Swap(i, j int) { p[uint(i)], p[uint(j)] = p[uint(j)], p[uint(i)] }
    62  func (p stringRvSlice) Less(i, j int) bool {
    63  	return p[uint(i)].v < p[uint(j)].v
    64  }
    65  
    66  type stringIntf struct {
    67  	v string
    68  	i interface{}
    69  }
    70  type stringIntfSlice []stringIntf
    71  
    72  func (p stringIntfSlice) Len() int      { return len(p) }
    73  func (p stringIntfSlice) Swap(i, j int) { p[uint(i)], p[uint(j)] = p[uint(j)], p[uint(i)] }
    74  func (p stringIntfSlice) Less(i, j int) bool {
    75  	return p[uint(i)].v < p[uint(j)].v
    76  }
    77  
    78  type float64Rv struct {
    79  	v float64
    80  	r reflect.Value
    81  }
    82  type float64RvSlice []float64Rv
    83  
    84  func (p float64RvSlice) Len() int      { return len(p) }
    85  func (p float64RvSlice) Swap(i, j int) { p[uint(i)], p[uint(j)] = p[uint(j)], p[uint(i)] }
    86  func (p float64RvSlice) Less(i, j int) bool {
    87  	return p[uint(i)].v < p[uint(j)].v || isNaN64(p[uint(i)].v) && !isNaN64(p[uint(j)].v)
    88  }
    89  
    90  type uint64Rv struct {
    91  	v uint64
    92  	r reflect.Value
    93  }
    94  type uint64RvSlice []uint64Rv
    95  
    96  func (p uint64RvSlice) Len() int      { return len(p) }
    97  func (p uint64RvSlice) Swap(i, j int) { p[uint(i)], p[uint(j)] = p[uint(j)], p[uint(i)] }
    98  func (p uint64RvSlice) Less(i, j int) bool {
    99  	return p[uint(i)].v < p[uint(j)].v
   100  }
   101  
   102  type int64Rv struct {
   103  	v int64
   104  	r reflect.Value
   105  }
   106  type int64RvSlice []int64Rv
   107  
   108  func (p int64RvSlice) Len() int      { return len(p) }
   109  func (p int64RvSlice) Swap(i, j int) { p[uint(i)], p[uint(j)] = p[uint(j)], p[uint(i)] }
   110  func (p int64RvSlice) Less(i, j int) bool {
   111  	return p[uint(i)].v < p[uint(j)].v
   112  }
   113  
   114  type timeRv struct {
   115  	v time.Time
   116  	r reflect.Value
   117  }
   118  type timeRvSlice []timeRv
   119  
   120  func (p timeRvSlice) Len() int      { return len(p) }
   121  func (p timeRvSlice) Swap(i, j int) { p[uint(i)], p[uint(j)] = p[uint(j)], p[uint(i)] }
   122  func (p timeRvSlice) Less(i, j int) bool {
   123  	return p[uint(i)].v.Before(p[uint(j)].v)
   124  }
   125  
   126  type bytesRv struct {
   127  	v []byte
   128  	r reflect.Value
   129  }
   130  type bytesRvSlice []bytesRv
   131  
   132  func (p bytesRvSlice) Len() int      { return len(p) }
   133  func (p bytesRvSlice) Swap(i, j int) { p[uint(i)], p[uint(j)] = p[uint(j)], p[uint(i)] }
   134  func (p bytesRvSlice) Less(i, j int) bool {
   135  	return bytes.Compare(p[uint(i)].v, p[uint(j)].v) == -1
   136  }
   137  
   138  type bytesIntf struct {
   139  	v []byte
   140  	i interface{}
   141  }
   142  type bytesIntfSlice []bytesIntf
   143  
   144  func (p bytesIntfSlice) Len() int      { return len(p) }
   145  func (p bytesIntfSlice) Swap(i, j int) { p[uint(i)], p[uint(j)] = p[uint(j)], p[uint(i)] }
   146  func (p bytesIntfSlice) Less(i, j int) bool {
   147  	return bytes.Compare(p[uint(i)].v, p[uint(j)].v) == -1
   148  }