working the get statement
This commit is contained in:
@@ -18,10 +18,20 @@ type SnippetModel struct {
|
||||
}
|
||||
|
||||
func (m *SnippetModel) Insert(title string, content string, expires int) (int, error) {
|
||||
return 0, nil
|
||||
stmt := `INSERT INTO snippets (title, content,created,expires) VALUES( ?,?, UTC_TIMESTAMP(), DATE_ADD(UTC_TIMESTAMP(), INTERVAL ? DAY))`
|
||||
result, err := m.DB.Exec(stmt, title, content, expires)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
id, err := result.LastInsertId()
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return int(id), nil
|
||||
}
|
||||
|
||||
func (m *SnippetModel) Get(id int) (*Snippet, error) {
|
||||
stmt := `SELECT`
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user