mirror of
https://git.unlock-music.dev/um/cli.git
synced 2025-02-20 04:21:28 +08:00
13 lines
326 B
Go
13 lines
326 B
Go
![]() |
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]
|
||
|
}
|