mirror of
https://github.com/pikami/cosmium.git
synced 2025-12-19 00:40:47 +00:00
Added get APIs for Stored Procedures, Triggers and User Defined Functions
This commit is contained in:
15
api/handlers/offers.go
Normal file
15
api/handlers/offers.go
Normal file
@@ -0,0 +1,15 @@
|
||||
package handlers
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
func GetOffers(c *gin.Context) {
|
||||
c.IndentedJSON(http.StatusOK, gin.H{
|
||||
"_rid": "",
|
||||
"_count": 0,
|
||||
"Offers": []interface{}{},
|
||||
})
|
||||
}
|
||||
22
api/handlers/stored_procedures.go
Normal file
22
api/handlers/stored_procedures.go
Normal file
@@ -0,0 +1,22 @@
|
||||
package handlers
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/pikami/cosmium/internal/repositories"
|
||||
)
|
||||
|
||||
func GetAllStoredProcedures(c *gin.Context) {
|
||||
databaseId := c.Param("databaseId")
|
||||
collectionId := c.Param("collId")
|
||||
|
||||
sps, status := repositories.GetAllStoredProcedures(databaseId, collectionId)
|
||||
|
||||
if status == repositories.StatusOk {
|
||||
c.IndentedJSON(http.StatusOK, gin.H{"_rid": "", "StoredProcedures": sps, "_count": len(sps)})
|
||||
return
|
||||
}
|
||||
|
||||
c.IndentedJSON(http.StatusInternalServerError, gin.H{"message": "Unknown error"})
|
||||
}
|
||||
22
api/handlers/triggers.go
Normal file
22
api/handlers/triggers.go
Normal file
@@ -0,0 +1,22 @@
|
||||
package handlers
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/pikami/cosmium/internal/repositories"
|
||||
)
|
||||
|
||||
func GetAllTriggers(c *gin.Context) {
|
||||
databaseId := c.Param("databaseId")
|
||||
collectionId := c.Param("collId")
|
||||
|
||||
triggers, status := repositories.GetAllTriggers(databaseId, collectionId)
|
||||
|
||||
if status == repositories.StatusOk {
|
||||
c.IndentedJSON(http.StatusOK, gin.H{"_rid": "", "Triggers": triggers, "_count": len(triggers)})
|
||||
return
|
||||
}
|
||||
|
||||
c.IndentedJSON(http.StatusInternalServerError, gin.H{"message": "Unknown error"})
|
||||
}
|
||||
22
api/handlers/user_defined_functions.go
Normal file
22
api/handlers/user_defined_functions.go
Normal file
@@ -0,0 +1,22 @@
|
||||
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"})
|
||||
}
|
||||
Reference in New Issue
Block a user