INNER CODE UNIT · Go
RegisterAPIEncoderFactory
resgateio/resgate · server/apiEncoding.go:32
func RegisterAPIEncoderFactory(name string, f APIEncoderFactory) {
if _, ok := apiEncoderFactories[name]; ok {
panic("multiple registration of API encoder factory " + name)
}
apiEncoderFactories[name] = f
}
// PathToRID parses a raw URL path and returns the resource ID.
// The prefix is the beginning of the path which is not part of the
// resource ID, and it should both start and end with /. Eg. "/api/"
func PathToRID(path, query, prefix string) string {
if len(path) == len(prefix) || !strings.HasPrefix(path, prefix) {
return ""
}
path = path[len(prefix):]
// Dot separator not allowed in path