You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gitea/models/db
Lunny Xiao dd30d9d5c0
Remove GetByBean method because sometimes it's danger when query condition parameter is zero and also introduce new generic methods (#28220)
The function `GetByBean` has an obvious defect that when the fields are
empty values, it will be ignored. Then users will get a wrong result
which is possibly used to make a security problem.

To avoid the possibility, this PR removed function `GetByBean` and all
references.
And some new generic functions have been introduced to be used.

The recommand usage like below.

```go
// if query an object according id
obj, err := db.GetByID[Object](ctx, id)
// query with other conditions
obj, err := db.Get[Object](ctx, builder.Eq{"a": a, "b":b})
```
1 year ago
..
install Implement FSFE REUSE for golang files (#21840) 2 years ago
paginator make writing main test easier (#27270) 1 year ago
common.go Fix NuGet search endpoints (#25613) 2 years ago
consistency.go Implement FSFE REUSE for golang files (#21840) 2 years ago
context.go Remove GetByBean method because sometimes it's danger when query condition parameter is zero and also introduce new generic methods (#28220) 1 year ago
context_committer_test.go Fix halfCommitter and WithTx (#22366) 2 years ago
context_test.go Always reuse transaction (#22362) 2 years ago
convert.go Support converting varchar to nvarchar for mssql database (#24105) 2 years ago
engine.go Rename `Sync2` -> `Sync` (#26479) 2 years ago
engine_test.go Rename `Sync2` -> `Sync` (#26479) 2 years ago
error.go Remove GetByBean method because sometimes it's danger when query condition parameter is zero and also introduce new generic methods (#28220) 1 year ago
index.go Fix index generation parallelly failure (#25235) 2 years ago
index_test.go Implement FSFE REUSE for golang files (#21840) 2 years ago
iterate.go refactor: make db iterate context aware (#27710) 1 year ago
iterate_test.go Remove GetByBean method because sometimes it's danger when query condition parameter is zero and also introduce new generic methods (#28220) 1 year ago
list.go Use db.Find instead of writing methods for every object (#28084) 1 year ago
list_test.go Use db.Find instead of writing methods for every object (#28084) 1 year ago
log.go Replace `interface{}` with `any` (#25686) 2 years ago
main_test.go make writing main test easier (#27270) 1 year ago
name.go Implement FSFE REUSE for golang files (#21840) 2 years ago
search.go Split lfs size from repository size (#22900) 2 years ago
sequence.go Refactor `setting.Database.UseXXX` to methods (#23354) 2 years ago
sql_postgres_with_schema.go Fix .golangci.yml (#22868) 2 years ago