forgejo/modules
Jason Song 477a1cc40e
Improve utils of slices (#22379)
- Move the file `compare.go` and `slice.go` to `slice.go`.
- Fix `ExistsInSlice`, it's buggy
  - It uses `sort.Search`, so it assumes that the input slice is sorted.
- It passes `func(i int) bool { return slice[i] == target })` to
`sort.Search`, that's incorrect, check the doc of `sort.Search`.
- Conbine `IsInt64InSlice(int64, []int64)` and `ExistsInSlice(string,
[]string)` to `SliceContains[T]([]T, T)`.
- Conbine `IsSliceInt64Eq([]int64, []int64)` and `IsEqualSlice([]string,
[]string)` to `SliceSortedEqual[T]([]T, T)`.
- Add `SliceEqual[T]([]T, T)` as a distinction from
`SliceSortedEqual[T]([]T, T)`.
- Redesign `RemoveIDFromList([]int64, int64) ([]int64, bool)` to
`SliceRemoveAll[T]([]T, T) []T`.
- Add `SliceContainsFunc[T]([]T, func(T) bool)` and
`SliceRemoveAllFunc[T]([]T, func(T) bool)` for general use.
- Add comments to explain why not `golang.org/x/exp/slices`.
- Add unit tests.
2023-01-11 13:31:16 +08:00
..
activitypub
analyze
auth
avatar Unify hashing for avatar (#22289) 2023-01-02 22:46:39 +01:00
base
cache Fix get system setting bug when enabled redis cache (#22295) 2023-01-02 00:06:52 +08:00
charset
container
context Use context parameter in models/git (#22367) 2023-01-09 11:50:54 +08:00
csv
doctor
emoji Fix unstable emoji sort (#22346) 2023-01-05 13:58:51 +02:00
eventsource Move convert package to services (#22264) 2022-12-29 10:57:15 +08:00
generate
git Use git command instead of exec.Cmd in blame (#22098) 2023-01-03 16:17:13 +08:00
gitgraph
graceful
hcaptcha
highlight
hostmatcher
html
httpcache
httplib
indexer
issue/template
json
lfs
log
markup Remove deadcode (#22245) 2022-12-27 09:15:35 +08:00
mcaptcha
metrics
migration
mirror
nosql
notification Always reuse transaction (#22362) 2023-01-08 09:34:58 +08:00
options
packages Use ErrInvalidArgument in packages (#22268) 2022-12-31 12:49:37 +01:00
paginator
password
pprof
private
process
proxy
proxyprotocol
public
queue Correctly handle select on multiple channels in Queues (#22146) 2022-12-30 02:06:47 +02:00
recaptcha
references
regexplru
repository Improve utils of slices (#22379) 2023-01-11 13:31:16 +08:00
secret
session
setting Don't lookup mail server when using sendmail (#22300) 2023-01-09 11:09:46 -05:00
sitemap Fix sitemap (#22272) 2022-12-30 23:31:00 +08:00
ssh
storage
structs Add sync_on_commit option for push mirrors api (#22271) 2022-12-30 19:22:51 +08:00
svg
sync
system
templates Display error log when a modified template has an error so that it could recovery when the error fixed (#22261) 2023-01-03 15:17:36 +08:00
test
timeutil Check for zero time instant in TimeStamp.IsZero() (#22171) 2022-12-20 10:04:55 +08:00
translation
typesniffer
updatechecker
upload
uri
user
util Improve utils of slices (#22379) 2023-01-11 13:31:16 +08:00
validation
watcher
web
webhook Restructure webhook module (#22256) 2023-01-01 23:23:15 +08:00