1
0
forked from um/cli
cli/algo/common/dispatch.go

13 lines
326 B
Go
Raw Normal View History

2020-12-26 07:47:10 +00:00
package common
type NewDecoderFunc func([]byte) Decoder
var decoderRegistry = make(map[string][]NewDecoderFunc)
func RegisterDecoder(ext string, dispatchFunc NewDecoderFunc) {
decoderRegistry[ext] = append(decoderRegistry[ext], dispatchFunc)
}
func GetDecoder(ext string) []NewDecoderFunc {
return decoderRegistry[ext]
}