feat: 新版 server 包 HTTP 基础实现

This commit is contained in:
kercylan98
2024-03-20 23:48:46 +08:00
parent 7239a278ee
commit b2c0bb0da3
18 changed files with 390 additions and 438 deletions

20
utils/super/context.go Normal file
View File

@@ -0,0 +1,20 @@
package super
import "context"
func WithCancelContext(ctx context.Context) *CancelContext {
ctx, cancel := context.WithCancel(ctx)
return &CancelContext{
Context: ctx,
cancel: cancel,
}
}
type CancelContext struct {
context.Context
cancel func()
}
func (c *CancelContext) Cancel() {
c.cancel()
}