Added link info endpoint

This commit is contained in:
2022-08-28 15:01:02 +02:00
parent 0944a14a97
commit 9da60fa4e7
8 changed files with 107 additions and 2 deletions

View File

@ -8,7 +8,7 @@ import (
var UrlTable = table.New(table.Metadata{
Name: "fivefeeteleven.urls",
Columns: []string{"id", "long_url", "created_at"},
Columns: []string{"id", "long_url", "lifespan", "created_at"},
PartKey: []string{"id"},
SortKey: []string{},
})
@ -16,5 +16,6 @@ var UrlTable = table.New(table.Metadata{
type UrlModel struct {
ID string
LongUrl string
Lifespan int64
CreatedAt time.Time
}

View File

@ -16,7 +16,8 @@ func Seed(session gocqlx.Session) error {
CREATE TABLE IF NOT EXISTS fivefeeteleven.urls (
id text PRIMARY KEY,
long_url text,
created_at timestamp
created_at timestamp,
lifespan bigint
)`)
if err != nil {