MCPcopy
hub / github.com/pocketbase/pocketbase / backupsList

Function backupsList

apis/backup.go:33–63  ·  view source on GitHub ↗
(e *core.RequestEvent)

Source from the content-addressed store, hash-verified

31}
32
33func backupsList(e *core.RequestEvent) error {
34 ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
35 defer cancel()
36
37 fsys, err := e.App.NewBackupsFilesystem()
38 if err != nil {
39 return e.BadRequestError("Failed to load backups filesystem.", err)
40 }
41 defer fsys.Close()
42
43 fsys.SetContext(ctx)
44
45 backups, err := fsys.List("")
46 if err != nil {
47 return e.BadRequestError("Failed to retrieve backup items. Raw error: \n"+err.Error(), nil)
48 }
49
50 result := make([]backupFileInfo, len(backups))
51
52 for i, obj := range backups {
53 modified, _ := types.ParseDateTime(obj.ModTime)
54
55 result[i] = backupFileInfo{
56 Key: obj.Key,
57 Size: obj.Size,
58 Modified: modified,
59 }
60 }
61
62 return e.JSON(http.StatusOK, result)
63}
64
65func backupDownload(e *core.RequestEvent) error {
66 fileToken := e.Request.URL.Query().Get("token")

Callers

nothing calls this directly

Calls 8

ParseDateTimeFunction · 0.92
BadRequestErrorMethod · 0.80
JSONMethod · 0.80
NewBackupsFilesystemMethod · 0.65
CloseMethod · 0.65
SetContextMethod · 0.65
ErrorMethod · 0.65
ListMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…