diff options
| author | Samuel Johnson <[email protected]> | 2025-11-25 20:52:35 -0500 |
|---|---|---|
| committer | Samuel Johnson <[email protected]> | 2025-11-25 20:52:35 -0500 |
| commit | 44d6620b32f31c04663c9e08a1c3954273230ee8 (patch) | |
| tree | a87cf977313ec95f050d7cdbbebd8bdae7c00ab2 /internal | |
| parent | 12602302f28478a9e4ef91e66f68347a4d76f8a6 (diff) | |
Tidy the code
Diffstat (limited to 'internal')
| -rw-r--r-- | internal/context/environment.go | 6 | ||||
| -rw-r--r-- | internal/dbmigrations.go | 3 | ||||
| -rw-r--r-- | internal/models/post.go | 10 | ||||
| -rw-r--r-- | internal/models/user.go | 6 |
4 files changed, 12 insertions, 13 deletions
diff --git a/internal/context/environment.go b/internal/context/environment.go index 35cb9d8..3e680cf 100644 --- a/internal/context/environment.go +++ b/internal/context/environment.go @@ -1,9 +1,9 @@ package context type DbCredentials struct { - Name string - Host string - Port uint64 + Name string + Host string + Port uint64 Username string Password string } diff --git a/internal/dbmigrations.go b/internal/dbmigrations.go index d5f4836..50badc0 100644 --- a/internal/dbmigrations.go +++ b/internal/dbmigrations.go @@ -8,7 +8,7 @@ import ( "golang.org/x/crypto/bcrypt" ) -func Migrate (db *sql.DB, webmaster string, passOne string, passTwo string) { +func Migrate(db *sql.DB, webmaster string, passOne string, passTwo string) { _, table_check := db.Query("SELECT * FROM logins;") if table_check != nil { _, err := db.Exec("CREATE TABLE logins (id SERIAL PRIMARY KEY, name VARCHAR(50) NOT NULL, time TIMESTAMP DEFAULT CURRENT_TIMESTAMP, pass_one TEXT NOT NULL, pass_two TEXT NOT NULL);") @@ -40,7 +40,6 @@ func Migrate (db *sql.DB, webmaster string, passOne string, passTwo string) { } } - _, table_check = db.Query("SELECT * FROM cookies;") if table_check != nil { _, err := db.Exec("CREATE TABLE cookies (id SERIAL PRIMARY KEY, content VARCHAR(255) NOT NULL, user_id INTEGER REFERENCES logins(id), expiration TIMESTAMP);") diff --git a/internal/models/post.go b/internal/models/post.go index d7f1aaa..95dde58 100644 --- a/internal/models/post.go +++ b/internal/models/post.go @@ -6,10 +6,10 @@ import ( ) type Post struct { - Id int - Name string - Time time.Time + Id int + Name string + Time time.Time FormattedTime string - Brief template.HTML - Content template.HTML + Brief template.HTML + Content template.HTML } diff --git a/internal/models/user.go b/internal/models/user.go index 8753810..e75ea80 100644 --- a/internal/models/user.go +++ b/internal/models/user.go @@ -1,9 +1,9 @@ package models type User struct { - Id int - Name string - Time string + Id int + Name string + Time string PassOne string PassTwo string } |
