Skip to content

Commit

Permalink
Add SavePerson method to Person model and create PERSON table in data…
Browse files Browse the repository at this point in the history
…base
  • Loading branch information
JonyBepary committed Oct 18, 2023
1 parent 3361370 commit 443fb72
Showing 1 changed file with 78 additions and 0 deletions.
78 changes: 78 additions & 0 deletions internal/model/person.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
package model

import (
"fmt"

"github.com/SohelAhmedJoni/Awazz-Backend/internal/durable"
)

var column []string = []string{
"Id",
"Attachment",
"AttributedTo",
"Context",
"MediaType",
"EndTime",
"Generator",
"Icon",
"Image",
"InReplyTo",
"Location",
"Preview",
"Published",
"Replies",
"StartTime",
"Summary",
"Tag",
"Updated",
"Url",
"Likes",
"Shares",
"Inbox",
"Outbox",
"Following",
"Followers",
"Liked",
"PreferredUsername",
"Endpoints",
"Streams",
"PublicKey"}
var column_type []string = []string{
"INTEGER PRIMARY KEY",
"BLOB",
"TEXT",
"TEXT",
"TEXT",
"NUMERIC",
"TEXT",
"BLOB",
"BLOB",
"TEXT",
"TEXT",
"TEXT",
"TEXT",
"TEXT",
"NUMERIC",
"TEXT",
"TEXT",
"TEXT",
"TEXT",
"TEXT",
"TEXT",
"TEXT",
"TEXT",
"TEXT",
"TEXT",
"TEXT",
"INTEGER",
"TEXT",
"BLOB"}

func (p *Person) SavePerson() error {
db,
err := durable.CreateDatabase("Database/comments")
if err != nil {
return err
}
db.Query(fmt.Sprintf("CREATE TABLE PERSON ( %v)", durable.SetColumn(column, column_type)))
}

0 comments on commit 443fb72

Please sign in to comment.