MCPcopy Create free account
hub / github.com/QuantumNous/new-api / applyExplicitLogTextFilter

Function applyExplicitLogTextFilter

model/log.go:19–31  ·  view source on GitHub ↗
(tx *gorm.DB, column string, value string)

Source from the content-addressed store, hash-verified

17)
18
19func applyExplicitLogTextFilter(tx *gorm.DB, column string, value string) (*gorm.DB, error) {
20 if value == "" {
21 return tx, nil
22 }
23 if strings.Contains(value, "%") {
24 condition, pattern, err := buildLogLikeCondition(column, value)
25 if err != nil {
26 return nil, err
27 }
28 return tx.Where(condition, pattern), nil
29 }
30 return tx.Where(column+" = ?", value), nil
31}
32
33func buildLogLikeCondition(column string, value string) (string, string, error) {
34 if common.UsingLogDatabase(common.DatabaseTypeClickHouse) {

Callers 3

GetAllLogsFunction · 0.85
GetUserLogsFunction · 0.85
SumUsedQuotaFunction · 0.85

Calls 2

buildLogLikeConditionFunction · 0.85
ContainsMethod · 0.80

Tested by

no test coverage detected