mirror of
https://github.com/pikami/cosmium.git
synced 2024-12-11 06:47:45 +00:00
23 lines
567 B
Go
23 lines
567 B
Go
package handlers
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
"github.com/pikami/cosmium/internal/repositories"
|
|
)
|
|
|
|
func GetAllUserDefinedFunctions(c *gin.Context) {
|
|
databaseId := c.Param("databaseId")
|
|
collectionId := c.Param("collId")
|
|
|
|
udfs, status := repositories.GetAllUserDefinedFunctions(databaseId, collectionId)
|
|
|
|
if status == repositories.StatusOk {
|
|
c.IndentedJSON(http.StatusOK, gin.H{"_rid": "", "UserDefinedFunctions": udfs, "_count": len(udfs)})
|
|
return
|
|
}
|
|
|
|
c.IndentedJSON(http.StatusInternalServerError, gin.H{"message": "Unknown error"})
|
|
}
|