Add Decoder Registry
Add Raw Decoder
This commit is contained in:
12
algo/common/dispatch.go
Normal file
12
algo/common/dispatch.go
Normal file
@ -0,0 +1,12 @@
|
||||
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]
|
||||
}
|
Reference in New Issue
Block a user