···
return syntax.ATURI(fmt.Sprintf("at://%s/%s/%s", i.OwnerDid, tangled.RepoIssueNSID, i.Rkey))
51
+
func IssueFromRecord(did, rkey string, record tangled.RepoIssue) Issue {
52
+
created, err := time.Parse(time.RFC3339, record.CreatedAt)
54
+
created = time.Now()
58
+
if record.Body != nil {
63
+
RepoAt: syntax.ATURI(record.Repo),
64
+
OwnerDid: record.Owner,
67
+
Title: record.Title,
69
+
Open: true, // new issues are open by default
73
+
func ResolveIssueFromAtUri(e Execer, issueUri syntax.ATURI) (syntax.ATURI, int, error) {
74
+
ownerDid := issueUri.Authority().String()
75
+
issueRkey := issueUri.RecordKey().String()
80
+
query := `select repo_at, issue_id from issues where owner_did = ? and rkey = ?`
81
+
err := e.QueryRow(query, ownerDid, issueRkey).Scan(&repoAt, &issueId)
86
+
return syntax.ATURI(repoAt), issueId, nil
89
+
func IssueCommentFromRecord(e Execer, did, rkey string, record tangled.RepoIssueComment) (Comment, error) {
90
+
created, err := time.Parse(time.RFC3339, record.CreatedAt)
92
+
created = time.Now()
96
+
if record.Owner != nil {
97
+
ownerDid = *record.Owner
100
+
issueUri, err := syntax.ParseATURI(record.Issue)
102
+
return Comment{}, err
105
+
repoAt, issueId, err := ResolveIssueFromAtUri(e, issueUri)
107
+
return Comment{}, err
110
+
comment := Comment{
111
+
OwnerDid: ownerDid,
119
+
return comment, nil
func NewIssue(tx *sql.Tx, issue *Issue) error {
···
row_num between ? and ?`,
repoAt, openValue, page.Offset+1, page.Offset+page.Limit)