MCPcopy Index your code
hub / github.com/writefreely/writefreely / compileFullExport

Function compileFullExport

export.go:103–132  ·  view source on GitHub ↗
(app *App, u *User)

Source from the content-addressed store, hash-verified

101}
102
103func compileFullExport(app *App, u *User) *ExportUser {
104 exportUser := &ExportUser{
105 User: u,
106 }
107
108 colls, err := app.db.GetCollections(u, app.cfg.App.Host)
109 if err != nil {
110 log.Error("unable to fetch collections: %v", err)
111 }
112
113 posts, err := app.db.GetAnonymousPosts(u, 0)
114 if err != nil {
115 log.Error("unable to fetch anon posts: %v", err)
116 }
117 exportUser.AnonymousPosts = *posts
118
119 var collObjs []CollectionObj
120 for _, c := range *colls {
121 co := &CollectionObj{Collection: c}
122 co.Posts, err = app.db.GetPosts(app.cfg, &c, 0, true, false, true, "")
123 if err != nil {
124 log.Error("unable to get collection posts: %v", err)
125 }
126 app.db.GetPostsCount(co, true)
127 collObjs = append(collObjs, *co)
128 }
129 exportUser.Collections = &collObjs
130
131 return exportUser
132}

Callers 1

viewExportFullFunction · 0.85

Calls 4

GetCollectionsMethod · 0.65
GetAnonymousPostsMethod · 0.65
GetPostsMethod · 0.65
GetPostsCountMethod · 0.65

Tested by

no test coverage detected