mirror of
https://github.com/safing/portbase
synced 2025-09-12 08:09:50 +00:00
Add database custom interface functions
This commit is contained in:
parent
e033cff403
commit
df62abdf1b
5 changed files with 166 additions and 128 deletions
|
@ -224,6 +224,17 @@ func RegisterEndpoint(e Endpoint) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func GetEndpointByPath(path string) (*Endpoint, error) {
|
||||
endpointsLock.Lock()
|
||||
defer endpointsLock.Unlock()
|
||||
endpoint, ok := endpoints[path]
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("no registered endpoint on path: %q", path)
|
||||
}
|
||||
|
||||
return endpoint, nil
|
||||
}
|
||||
|
||||
func (e *Endpoint) check() error {
|
||||
// Check path.
|
||||
if strings.TrimSpace(e.Path) == "" {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue