init: hgmj server initial commit

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-10-08 16:50:13 +08:00
co-authored by Claude Opus 4.7
commit 625e89c15d
1870 changed files with 254090 additions and 0 deletions
+57
View File
@@ -0,0 +1,57 @@
package searcher
// Opter Opter
type Opter interface {
SetSkip(v int64) Opter
Skip() int64
SetLimit(v int64) Opter
Limit() int64
SetSort(key string, v int64) Opter
Sort() D
}
type Option struct {
skip *int64
limit *int64
sort D
}
const MaxLimit = 50
const MinLimit = 1
func (o *Option) Skip() int64 {
if o.skip == nil {
return 0
}
return *o.skip
}
func (o *Option) SetSkip(v int64) Opter {
o.skip = &v
return o
}
func (o *Option) Limit() int64 {
if o.limit == nil {
return MinLimit
}
if *o.limit > MaxLimit {
return MaxLimit
}
return *o.limit
}
func (o *Option) SetLimit(v int64) Opter {
o.limit = &v
return o
}
func (o *Option) Sort() D {
return o.sort
}
func (o *Option) SetSort(key string, v int64) Opter {
o.sort = append(o.sort, E{Key: key, Value: v})
return o
}