-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add SavePerson method to Person model and create PERSON table in data…
…base
- Loading branch information
1 parent
3361370
commit 443fb72
Showing
1 changed file
with
78 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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))) | ||
} |