diff options
author | Alexander Neonxp Kiryukhin <i@neonxp.ru> | 2024-10-06 17:04:37 +0300 |
---|---|---|
committer | Alexander Neonxp Kiryukhin <i@neonxp.ru> | 2024-10-06 17:04:37 +0300 |
commit | 6160b4fdc5f37e4ceaa6b3c5acc855f466049d61 (patch) | |
tree | b6e41f9cad22515a61cc50b0a82d98ee55e0c3e3 /pkg/model | |
parent | 81b13617c4d0ca68afb181d1105386f0c339864d (diff) |
Первая версия
Diffstat (limited to 'pkg/model')
-rw-r--r-- | pkg/model/quote.go | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/pkg/model/quote.go b/pkg/model/quote.go new file mode 100644 index 0000000..0ad89cf --- /dev/null +++ b/pkg/model/quote.go @@ -0,0 +1,23 @@ +package model + +import ( + "strings" + "time" + + "github.com/uptrace/bun" +) + +type Quote struct { + bun.BaseModel `bun:"table:quotes,alias:q"` + + ID int64 `bun:",pk,autoincrement"` + Quote string `bun:",notnull"` + Approved bool + Archive bool + CreatedAt time.Time `bun:",nullzero,notnull,default:current_timestamp"` + DeletedAt time.Time `bun:",soft_delete,nullzero"` +} + +func (q *Quote) Text() string { + return strings.ReplaceAll(q.Quote, "\n", "<br />") +} |