Adds feed type to Feed struct and table schema
This commit is contained in:
parent
efff6edf0e
commit
4f86ab9cb0
2 changed files with 19 additions and 4 deletions
7
internal/database/migrations/4_add-type-to-feed.sql
Normal file
7
internal/database/migrations/4_add-type-to-feed.sql
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
-- +migrate Up
|
||||||
|
ALTER TABLE feed
|
||||||
|
ADD COLUMN type text;
|
||||||
|
|
||||||
|
-- +migrate Down
|
||||||
|
ALTER TABLE feed
|
||||||
|
DROP COLUMN type;
|
||||||
|
|
@ -1,8 +1,16 @@
|
||||||
package model
|
package model
|
||||||
|
|
||||||
|
type FeedType int
|
||||||
|
|
||||||
|
const (
|
||||||
|
Rss FeedType = iota
|
||||||
|
Youtube
|
||||||
|
)
|
||||||
|
|
||||||
type Feed struct {
|
type Feed struct {
|
||||||
ID int64 `json:"id"`
|
ID int64 `json:"id"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
Url string `json:"url" validate:"required,url"`
|
Url string `json:"url" validate:"required,url"`
|
||||||
UserID string `json:"userId" validate:"required"`
|
UserID string `json:"userId" validate:"required"`
|
||||||
|
Type FeedType `json:"type"`
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue