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

Method GetCollectionForPad

database.go:890–906  ·  view source on GitHub ↗
(alias string)

Source from the content-addressed store, hash-verified

888}
889
890func (db *datastore) GetCollectionForPad(alias string) (*Collection, error) {
891 c := &Collection{Alias: alias}
892
893 row := db.QueryRow("SELECT id, alias, title, description, privacy FROM collections WHERE alias = ?", alias)
894
895 err := row.Scan(&c.ID, &c.Alias, &c.Title, &c.Description, &c.Visibility)
896 switch {
897 case err == sql.ErrNoRows:
898 return c, impart.HTTPError{http.StatusNotFound, "Collection doesn't exist."}
899 case err != nil:
900 log.Error("Failed selecting from collections: %v", err)
901 return c, ErrInternalGeneral
902 }
903 c.Public = c.IsPublic()
904
905 return c, nil
906}
907
908func (db *datastore) GetCollectionByID(id int64) (*Collection, error) {
909 return db.GetCollectionBy("id = ?", id)

Callers

nothing calls this directly

Calls 1

IsPublicMethod · 0.95

Tested by

no test coverage detected