mirror of
https://github.com/eolinker/apinto
synced 2025-09-26 21:01:19 +08:00
35 lines
577 B
Go
35 lines
577 B
Go
package grpc_to_http
|
|
|
|
import (
|
|
"fmt"
|
|
"sync"
|
|
|
|
"github.com/eolinker/apinto/drivers"
|
|
"github.com/eolinker/eosc"
|
|
)
|
|
|
|
const (
|
|
Name = "grpc_to_http"
|
|
)
|
|
|
|
var (
|
|
once = sync.Once{}
|
|
worker eosc.IWorkers
|
|
)
|
|
|
|
func Register(register eosc.IExtenderDriverRegister) {
|
|
register.RegisterExtenderDriver(Name, NewFactory())
|
|
}
|
|
|
|
func NewFactory() eosc.IExtenderDriverFactory {
|
|
return drivers.NewFactory[Config](Create, Check)
|
|
}
|
|
|
|
func Check(cfg *Config, workers map[eosc.RequireId]eosc.IWorker) error {
|
|
if cfg.ProtobufID == "" {
|
|
return fmt.Errorf("protobuf id is empty")
|
|
}
|
|
|
|
return nil
|
|
}
|