server-go/web/server-handler.go
crusader 7f7773d01b ing
2018-04-13 16:11:43 +09:00

36 lines
543 B
Go

package web
import (
"sync/atomic"
"git.loafle.net/commons/server-go"
)
type ServerHandler interface {
server.ServerHandler
server.ReadWriteHandler
}
type ServerHandlers struct {
server.ServerHandlers
server.ReadWriteHandlers
validated atomic.Value
}
func (sh *ServerHandlers) Validate() error {
if nil != sh.validated.Load() {
return nil
}
sh.validated.Store(true)
if err := sh.ServerHandlers.Validate(); nil != err {
return err
}
if err := sh.ReadWriteHandlers.Validate(); nil != err {
return err
}
return nil
}