MCPcopy Index your code
hub / github.com/CovenantSQL/CovenantSQL / createDB

Function createDB

cmd/cql-proxy/api/database.go:41–73  ·  view source on GitHub ↗
(c *gin.Context)

Source from the content-addressed store, hash-verified

39)
40
41func createDB(c *gin.Context) {
42 r := struct {
43 NodeCount uint16 `json:"node" form:"node" binding:"gt=0"`
44 }{}
45
46 if err := c.ShouldBind(&r); err != nil {
47 abortWithError(c, http.StatusBadRequest, err)
48 return
49 }
50
51 developer := getDeveloperID(c)
52
53 p, err := model.GetMainAccount(model.GetDB(c), developer)
54 if err != nil {
55 _ = c.Error(err)
56 abortWithError(c, http.StatusBadRequest, ErrNoMainAccount)
57 return
58 }
59
60 // run task
61 taskID, err := getTaskManager(c).New(model.TaskCreateDB, developer, p.ID, gin.H{
62 "node_count": r.NodeCount,
63 })
64 if err != nil {
65 _ = c.Error(err)
66 abortWithError(c, http.StatusInternalServerError, ErrCreateTaskFailed)
67 return
68 }
69
70 responseWithData(c, http.StatusOK, gin.H{
71 "task_id": taskID,
72 })
73}
74
75func topUp(c *gin.Context) {
76 r := struct {

Callers

nothing calls this directly

Calls 8

GetMainAccountFunction · 0.92
GetDBFunction · 0.92
abortWithErrorFunction · 0.85
getDeveloperIDFunction · 0.85
getTaskManagerFunction · 0.85
responseWithDataFunction · 0.85
ErrorMethod · 0.80
NewMethod · 0.65

Tested by

no test coverage detected