MCPcopy
hub / github.com/writefreely/writefreely / getRawPost

Function getRawPost

posts.go:1376–1405  ·  view source on GitHub ↗
(app *App, friendlyID string)

Source from the content-addressed store, hash-verified

1374}
1375
1376func getRawPost(app *App, friendlyID string) *RawPost {
1377 var content, font, title string
1378 var isRTL sql.NullBool
1379 var lang sql.NullString
1380 var ownerID sql.NullInt64
1381 var created, updated time.Time
1382
1383 err := app.db.QueryRow("SELECT title, content, text_appearance, language, rtl, created, updated, owner_id FROM posts WHERE id = ?", friendlyID).Scan(&title, &content, &font, &lang, &isRTL, &created, &updated, &ownerID)
1384 switch {
1385 case err == sql.ErrNoRows:
1386 return &RawPost{Content: "", Found: false, Gone: false}
1387 case err != nil:
1388 log.Error("Unable to fetch getRawPost: %s", err)
1389 return &RawPost{Content: "", Found: true, Gone: false}
1390 }
1391
1392 return &RawPost{
1393 Title: title,
1394 Content: content,
1395 Font: font,
1396 Created: created,
1397 Updated: updated,
1398 IsRTL: isRTL,
1399 Language: lang,
1400 OwnerID: ownerID.Int64,
1401 Found: true,
1402 Gone: content == "" && title == "",
1403 }
1404
1405}
1406
1407// TODO; return a Post!
1408func getRawCollectionPost(app *App, slug, collAlias string) *RawPost {

Callers 2

handleViewPadFunction · 0.85
handleViewMetaFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected