Upgrade goext

This commit is contained in:
Mike Schwörer 2024-05-31 23:56:16 +02:00
parent d5d89ee93a
commit 7553e1f51e
Signed by: Mikescher
GPG Key ID: D3C7172E0A70F8CF
28 changed files with 210 additions and 466 deletions

View File

@ -8,18 +8,27 @@
- [ ] Channel List
* [ ] Show subs
* [ ] CRUD
* [ ] what about unsubbed foreign channels? - thex should still be visible (or should they, do i still get the messages?)
- [ ] Sub List
* [ ] Sub/Unsub/Accept/Deny
- [ ] Debug List (Show logs, requests)
- [ ] Key List
* [ ] CRUD
- [ ] Auto R-only key for admin, use for QR+link
- [ ] Auto R-only key for admin, use for QR+link+send
- [ ] settings
- [ ] notifications
- [ ] push navigation stack
- [ ] read + migrate old SharedPrefs
- [ ] read + migrate old SharedPrefs (or not? - who uses SCN even??)
- [ ] Account-Page
- [ ] Logout
- [ ] Send-page
-----
- [ ] Switch server to sq style from faby
- [ ] switch from mattn to go-sqlite
- [ ] Single struct for model/db/json
- [ ] use sq.Query | sq.Update | sq.InsertAndQuery | ....
- [ ] sq.DBOptions - enable CommentTrimmer and DefaultConverter
- [ ] run unit-tests...

View File

@ -11,6 +11,7 @@ import (
"github.com/rs/zerolog/log"
"gogs.mikescher.com/BlackForestBytes/goext/dataext"
"gogs.mikescher.com/BlackForestBytes/goext/langext"
"math/rand"
"runtime/debug"
"time"
)
@ -60,7 +61,7 @@ func Wrap(rlacc RequestLogAcceptor, fn WHandlerFunc) gin.HandlerFunc {
panic(err)
}
time.Sleep(retrySleep)
time.Sleep(time.Duration(int64(float64(retrySleep) * (0.5 + rand.Float64()))))
continue
}
@ -174,8 +175,14 @@ func resetBody(g *gin.Context) error {
func isSqlite3Busy(r HTTPResponse) bool {
if errwrap, ok := r.(*errorHTTPResponse); ok && errwrap != nil {
if s3err, ok := (errwrap.error).(sqlite3.Error); ok {
if s3err.Code == sqlite3.ErrBusy {
if errors.Is(errwrap.error, sqlite3.ErrBusy) {
return true
}
var s3err sqlite3.Error
if errors.As(errwrap.error, &s3err) {
if errors.Is(s3err.Code, sqlite3.ErrBusy) {
return true
}
}

View File

@ -75,7 +75,7 @@ func (pp *DBPreprocessor) Init(ctx context.Context) error {
if err != nil {
return err
}
resrows1, err := sq.ScanAll[tabInfo](rows1, sq.SModeFast, sq.Unsafe, true)
resrows1, err := sq.ScanAll[tabInfo](ctx, pp.db, rows1, sq.SModeFast, sq.Unsafe, true)
if err != nil {
return err
}
@ -85,7 +85,7 @@ func (pp *DBPreprocessor) Init(ctx context.Context) error {
if err != nil {
return err
}
resrows2, err := sq.ScanAll[colInfo](rows2, sq.SModeFast, sq.Unsafe, true)
resrows2, err := sq.ScanAll[colInfo](ctx, pp.db, rows2, sq.SModeFast, sq.Unsafe, true)
if err != nil {
return err
}

View File

@ -42,7 +42,7 @@ func NewLogsDatabase(cfg server.Config) (*Database, error) {
xdb.SetConnMaxIdleTime(60 * time.Minute)
}
qqdb := sq.NewDB(xdb)
qqdb := sq.NewDB(xdb, sq.DBOptions{})
if conf.EnableLogger {
qqdb.AddListener(dbtools.DBLogger{})

View File

@ -23,7 +23,7 @@ func (db *Database) GetChannelByName(ctx db.TxContext, userid models.UserID, cha
return nil, err
}
channel, err := models.DecodeChannel(rows)
channel, err := models.DecodeChannel(ctx, tx, rows)
if errors.Is(err, sql.ErrNoRows) {
return nil, nil
}
@ -47,7 +47,7 @@ func (db *Database) GetChannelByID(ctx db.TxContext, chanid models.ChannelID) (*
return nil, err
}
channel, err := models.DecodeChannel(rows)
channel, err := models.DecodeChannel(ctx, tx, rows)
if errors.Is(err, sql.ErrNoRows) {
return nil, nil
}
@ -108,7 +108,7 @@ func (db *Database) ListChannelsByOwner(ctx db.TxContext, userid models.UserID,
return nil, err
}
data, err := models.DecodeChannelsWithSubscription(rows)
data, err := models.DecodeChannelsWithSubscription(ctx, tx, rows)
if err != nil {
return nil, err
}
@ -138,7 +138,7 @@ func (db *Database) ListChannelsBySubscriber(ctx db.TxContext, userid models.Use
return nil, err
}
data, err := models.DecodeChannelsWithSubscription(rows)
data, err := models.DecodeChannelsWithSubscription(ctx, tx, rows)
if err != nil {
return nil, err
}
@ -169,7 +169,7 @@ func (db *Database) ListChannelsByAccess(ctx db.TxContext, userid models.UserID,
return nil, err
}
data, err := models.DecodeChannelsWithSubscription(rows)
data, err := models.DecodeChannelsWithSubscription(ctx, tx, rows)
if err != nil {
return nil, err
}
@ -203,7 +203,7 @@ func (db *Database) GetChannel(ctx db.TxContext, userid models.UserID, channelid
return models.ChannelWithSubscription{}, err
}
channel, err := models.DecodeChannelWithSubscription(rows)
channel, err := models.DecodeChannelWithSubscription(ctx, tx, rows)
if err != nil {
return models.ChannelWithSubscription{}, err
}

View File

@ -56,7 +56,7 @@ func (db *Database) ListClients(ctx db.TxContext, userid models.UserID) ([]model
return nil, err
}
data, err := models.DecodeClients(rows)
data, err := models.DecodeClients(ctx, tx, rows)
if err != nil {
return nil, err
}
@ -78,7 +78,7 @@ func (db *Database) GetClient(ctx db.TxContext, userid models.UserID, clientid m
return models.Client{}, err
}
client, err := models.DecodeClient(rows)
client, err := models.DecodeClient(ctx, tx, rows)
if err != nil {
return models.Client{}, err
}

View File

@ -42,7 +42,7 @@ func NewPrimaryDatabase(cfg server.Config) (*Database, error) {
xdb.SetConnMaxIdleTime(60 * time.Minute)
}
qqdb := sq.NewDB(xdb)
qqdb := sq.NewDB(xdb, sq.DBOptions{})
if conf.EnableLogger {
qqdb.AddListener(dbtools.DBLogger{})

View File

@ -82,7 +82,7 @@ func (db *Database) ListRetrieableDeliveries(ctx db.TxContext, pageSize int) ([]
return nil, err
}
data, err := models.DecodeDeliveries(rows)
data, err := models.DecodeDeliveries(ctx, tx, rows)
if err != nil {
return nil, err
}

View File

@ -49,7 +49,7 @@ func (db *Database) ListKeyTokens(ctx db.TxContext, ownerID models.UserID) ([]mo
return nil, err
}
data, err := models.DecodeKeyTokens(rows)
data, err := models.DecodeKeyTokens(ctx, tx, rows)
if err != nil {
return nil, err
}
@ -71,7 +71,7 @@ func (db *Database) GetKeyToken(ctx db.TxContext, userid models.UserID, keyToken
return models.KeyToken{}, err
}
keyToken, err := models.DecodeKeyToken(rows)
keyToken, err := models.DecodeKeyToken(ctx, tx, rows)
if err != nil {
return models.KeyToken{}, err
}
@ -90,7 +90,7 @@ func (db *Database) GetKeyTokenByToken(ctx db.TxContext, key string) (*models.Ke
return nil, err
}
user, err := models.DecodeKeyToken(rows)
user, err := models.DecodeKeyToken(ctx, tx, rows)
if errors.Is(err, sql.ErrNoRows) {
return nil, nil
}

View File

@ -21,7 +21,7 @@ func (db *Database) GetMessageByUserMessageID(ctx db.TxContext, usrMsgId string)
return nil, err
}
msg, err := models.DecodeMessage(rows)
msg, err := models.DecodeMessage(ctx, tx, rows)
if errors.Is(err, sql.ErrNoRows) {
return nil, nil
}
@ -50,7 +50,7 @@ func (db *Database) GetMessage(ctx db.TxContext, scnMessageID models.MessageID,
return models.Message{}, err
}
msg, err := models.DecodeMessage(rows)
msg, err := models.DecodeMessage(ctx, tx, rows)
if err != nil {
return models.Message{}, err
}
@ -138,7 +138,7 @@ func (db *Database) ListMessages(ctx db.TxContext, filter models.MessageFilter,
return nil, ct.CursorToken{}, err
}
data, err := models.DecodeMessages(rows)
data, err := models.DecodeMessages(ctx, tx, rows)
if err != nil {
return nil, ct.CursorToken{}, err
}

View File

@ -50,7 +50,7 @@ func (db *Database) ListSubscriptions(ctx db.TxContext, filter models.Subscripti
return nil, err
}
data, err := models.DecodeSubscriptions(rows)
data, err := models.DecodeSubscriptions(ctx, tx, rows)
if err != nil {
return nil, err
}
@ -69,7 +69,7 @@ func (db *Database) GetSubscription(ctx db.TxContext, subid models.SubscriptionI
return models.Subscription{}, err
}
sub, err := models.DecodeSubscription(rows)
sub, err := models.DecodeSubscription(ctx, tx, rows)
if err != nil {
return models.Subscription{}, err
}
@ -91,7 +91,7 @@ func (db *Database) GetSubscriptionBySubscriber(ctx db.TxContext, subscriberId m
return nil, err
}
user, err := models.DecodeSubscription(rows)
user, err := models.DecodeSubscription(ctx, tx, rows)
if errors.Is(err, sql.ErrNoRows) {
return nil, nil
}

View File

@ -61,7 +61,7 @@ func (db *Database) GetUser(ctx db.TxContext, userid models.UserID) (models.User
return models.User{}, err
}
user, err := models.DecodeUser(rows)
user, err := models.DecodeUser(ctx, tx, rows)
if err != nil {
return models.User{}, err
}

View File

@ -42,7 +42,7 @@ func NewRequestsDatabase(cfg server.Config) (*Database, error) {
xdb.SetConnMaxIdleTime(60 * time.Minute)
}
qqdb := sq.NewDB(xdb)
qqdb := sq.NewDB(xdb, sq.DBOptions{})
if conf.EnableLogger {
qqdb.AddListener(dbtools.DBLogger{})
@ -92,7 +92,7 @@ func (db *Database) Migrate(outerctx context.Context) error {
schemastr := schema.RequestsSchema[schema.RequestsSchemaVersion].SQL
schemahash := schema.RequestsSchema[schema.RequestsSchemaVersion].Hash
schemahash, err := sq.HashSqliteSchema(tctx, schemastr)
schemahash, err := sq.HashMattnSqliteSchema(tctx, schemastr)
if err != nil {
return err
}

View File

@ -78,7 +78,7 @@ func (db *Database) ListRequestLogs(ctx context.Context, filter models.RequestLo
return nil, ct.CursorToken{}, err
}
data, err := models.DecodeRequestLogs(rows)
data, err := models.DecodeRequestLogs(ctx, db.db, rows)
if err != nil {
return nil, ct.CursorToken{}, err
}

View File

@ -1,6 +1,7 @@
package models
import (
"context"
"github.com/jmoiron/sqlx"
"gogs.mikescher.com/BlackForestBytes/goext/langext"
"gogs.mikescher.com/BlackForestBytes/goext/sq"
@ -115,32 +116,32 @@ func (c ChannelWithSubscriptionDB) Model() ChannelWithSubscription {
}
}
func DecodeChannel(r *sqlx.Rows) (Channel, error) {
data, err := sq.ScanSingle[ChannelDB](r, sq.SModeFast, sq.Safe, true)
func DecodeChannel(ctx context.Context, q sq.Queryable, r *sqlx.Rows) (Channel, error) {
data, err := sq.ScanSingle[ChannelDB](ctx, q, r, sq.SModeFast, sq.Safe, true)
if err != nil {
return Channel{}, err
}
return data.Model(), nil
}
func DecodeChannels(r *sqlx.Rows) ([]Channel, error) {
data, err := sq.ScanAll[ChannelDB](r, sq.SModeFast, sq.Safe, true)
func DecodeChannels(ctx context.Context, q sq.Queryable, r *sqlx.Rows) ([]Channel, error) {
data, err := sq.ScanAll[ChannelDB](ctx, q, r, sq.SModeFast, sq.Safe, true)
if err != nil {
return nil, err
}
return langext.ArrMap(data, func(v ChannelDB) Channel { return v.Model() }), nil
}
func DecodeChannelWithSubscription(r *sqlx.Rows) (ChannelWithSubscription, error) {
data, err := sq.ScanSingle[ChannelWithSubscriptionDB](r, sq.SModeExtended, sq.Safe, true)
func DecodeChannelWithSubscription(ctx context.Context, q sq.Queryable, r *sqlx.Rows) (ChannelWithSubscription, error) {
data, err := sq.ScanSingle[ChannelWithSubscriptionDB](ctx, q, r, sq.SModeExtended, sq.Safe, true)
if err != nil {
return ChannelWithSubscription{}, err
}
return data.Model(), nil
}
func DecodeChannelsWithSubscription(r *sqlx.Rows) ([]ChannelWithSubscription, error) {
data, err := sq.ScanAll[ChannelWithSubscriptionDB](r, sq.SModeExtended, sq.Safe, true)
func DecodeChannelsWithSubscription(ctx context.Context, q sq.Queryable, r *sqlx.Rows) ([]ChannelWithSubscription, error) {
data, err := sq.ScanAll[ChannelWithSubscriptionDB](ctx, q, r, sq.SModeExtended, sq.Safe, true)
if err != nil {
return nil, err
}

View File

@ -1,6 +1,7 @@
package models
import (
"context"
"github.com/jmoiron/sqlx"
"gogs.mikescher.com/BlackForestBytes/goext/langext"
"gogs.mikescher.com/BlackForestBytes/goext/sq"
@ -71,16 +72,16 @@ func (c ClientDB) Model() Client {
}
}
func DecodeClient(r *sqlx.Rows) (Client, error) {
data, err := sq.ScanSingle[ClientDB](r, sq.SModeFast, sq.Safe, true)
func DecodeClient(ctx context.Context, q sq.Queryable, r *sqlx.Rows) (Client, error) {
data, err := sq.ScanSingle[ClientDB](ctx, q, r, sq.SModeFast, sq.Safe, true)
if err != nil {
return Client{}, err
}
return data.Model(), nil
}
func DecodeClients(r *sqlx.Rows) ([]Client, error) {
data, err := sq.ScanAll[ClientDB](r, sq.SModeFast, sq.Safe, true)
func DecodeClients(ctx context.Context, q sq.Queryable, r *sqlx.Rows) ([]Client, error) {
data, err := sq.ScanAll[ClientDB](ctx, q, r, sq.SModeFast, sq.Safe, true)
if err != nil {
return nil, err
}

View File

@ -1,6 +1,7 @@
package models
import (
"context"
"github.com/jmoiron/sqlx"
"gogs.mikescher.com/BlackForestBytes/goext/langext"
"gogs.mikescher.com/BlackForestBytes/goext/sq"
@ -88,16 +89,16 @@ func (d DeliveryDB) Model() Delivery {
}
}
func DecodeDelivery(r *sqlx.Rows) (Delivery, error) {
data, err := sq.ScanSingle[DeliveryDB](r, sq.SModeFast, sq.Safe, true)
func DecodeDelivery(ctx context.Context, q sq.Queryable, r *sqlx.Rows) (Delivery, error) {
data, err := sq.ScanSingle[DeliveryDB](ctx, q, r, sq.SModeFast, sq.Safe, true)
if err != nil {
return Delivery{}, err
}
return data.Model(), nil
}
func DecodeDeliveries(r *sqlx.Rows) ([]Delivery, error) {
data, err := sq.ScanAll[DeliveryDB](r, sq.SModeFast, sq.Safe, true)
func DecodeDeliveries(ctx context.Context, q sq.Queryable, r *sqlx.Rows) ([]Delivery, error) {
data, err := sq.ScanAll[DeliveryDB](ctx, q, r, sq.SModeFast, sq.Safe, true)
if err != nil {
return nil, err
}

View File

@ -5,7 +5,7 @@ package models
import "gogs.mikescher.com/BlackForestBytes/goext/langext"
import "gogs.mikescher.com/BlackForestBytes/goext/enums"
const ChecksumEnumGenerator = "69a99f8c01a15baad2fc9b99c516a700e02ce4dbcae452699e6d43cc23bc01bc" // GoExtVersion: 0.0.463
const ChecksumEnumGenerator = "20ad4720103f17781ed6aaa102b503abb182ac08c077b42d4f56557ef38f28eb" // GoExtVersion: 0.0.463
// ================================ ClientType ================================
//

View File

@ -15,7 +15,7 @@ import "reflect"
import "regexp"
import "strings"
const ChecksumCharsetIDGenerator = "69a99f8c01a15baad2fc9b99c516a700e02ce4dbcae452699e6d43cc23bc01bc" // GoExtVersion: 0.0.463
const ChecksumCharsetIDGenerator = "20ad4720103f17781ed6aaa102b503abb182ac08c077b42d4f56557ef38f28eb" // GoExtVersion: 0.0.463
const idlen = 24

View File

@ -1,6 +1,7 @@
package models
import (
"context"
"github.com/jmoiron/sqlx"
"gogs.mikescher.com/BlackForestBytes/goext/langext"
"gogs.mikescher.com/BlackForestBytes/goext/sq"
@ -149,16 +150,16 @@ func (k KeyTokenDB) Model() KeyToken {
}
}
func DecodeKeyToken(r *sqlx.Rows) (KeyToken, error) {
data, err := sq.ScanSingle[KeyTokenDB](r, sq.SModeFast, sq.Safe, true)
func DecodeKeyToken(ctx context.Context, q sq.Queryable, r *sqlx.Rows) (KeyToken, error) {
data, err := sq.ScanSingle[KeyTokenDB](ctx, q, r, sq.SModeFast, sq.Safe, true)
if err != nil {
return KeyToken{}, err
}
return data.Model(), nil
}
func DecodeKeyTokens(r *sqlx.Rows) ([]KeyToken, error) {
data, err := sq.ScanAll[KeyTokenDB](r, sq.SModeFast, sq.Safe, true)
func DecodeKeyTokens(ctx context.Context, q sq.Queryable, r *sqlx.Rows) ([]KeyToken, error) {
data, err := sq.ScanAll[KeyTokenDB](ctx, q, r, sq.SModeFast, sq.Safe, true)
if err != nil {
return nil, err
}

View File

@ -1,6 +1,7 @@
package models
import (
"context"
"github.com/jmoiron/sqlx"
"gogs.mikescher.com/BlackForestBytes/goext/langext"
"gogs.mikescher.com/BlackForestBytes/goext/sq"
@ -145,16 +146,16 @@ func (m MessageDB) Model() Message {
}
}
func DecodeMessage(r *sqlx.Rows) (Message, error) {
data, err := sq.ScanSingle[MessageDB](r, sq.SModeFast, sq.Safe, true)
func DecodeMessage(ctx context.Context, q sq.Queryable, r *sqlx.Rows) (Message, error) {
data, err := sq.ScanSingle[MessageDB](ctx, q, r, sq.SModeFast, sq.Safe, true)
if err != nil {
return Message{}, err
}
return data.Model(), nil
}
func DecodeMessages(r *sqlx.Rows) ([]Message, error) {
data, err := sq.ScanAll[MessageDB](r, sq.SModeFast, sq.Safe, true)
func DecodeMessages(ctx context.Context, q sq.Queryable, r *sqlx.Rows) ([]Message, error) {
data, err := sq.ScanAll[MessageDB](ctx, q, r, sq.SModeFast, sq.Safe, true)
if err != nil {
return nil, err
}

View File

@ -1,6 +1,7 @@
package models
import (
"context"
"github.com/jmoiron/sqlx"
"gogs.mikescher.com/BlackForestBytes/goext/langext"
"gogs.mikescher.com/BlackForestBytes/goext/sq"
@ -170,16 +171,16 @@ func (c RequestLogDB) Model() RequestLog {
}
}
func DecodeRequestLog(r *sqlx.Rows) (RequestLog, error) {
data, err := sq.ScanSingle[RequestLogDB](r, sq.SModeFast, sq.Safe, true)
func DecodeRequestLog(ctx context.Context, q sq.Queryable, r *sqlx.Rows) (RequestLog, error) {
data, err := sq.ScanSingle[RequestLogDB](ctx, q, r, sq.SModeFast, sq.Safe, true)
if err != nil {
return RequestLog{}, err
}
return data.Model(), nil
}
func DecodeRequestLogs(r *sqlx.Rows) ([]RequestLog, error) {
data, err := sq.ScanAll[RequestLogDB](r, sq.SModeFast, sq.Safe, true)
func DecodeRequestLogs(ctx context.Context, q sq.Queryable, r *sqlx.Rows) ([]RequestLog, error) {
data, err := sq.ScanAll[RequestLogDB](ctx, q, r, sq.SModeFast, sq.Safe, true)
if err != nil {
return nil, err
}

View File

@ -1,6 +1,7 @@
package models
import (
"context"
"github.com/jmoiron/sqlx"
"gogs.mikescher.com/BlackForestBytes/goext/langext"
"gogs.mikescher.com/BlackForestBytes/goext/sq"
@ -68,16 +69,16 @@ func (s SubscriptionDB) Model() Subscription {
}
}
func DecodeSubscription(r *sqlx.Rows) (Subscription, error) {
data, err := sq.ScanSingle[SubscriptionDB](r, sq.SModeFast, sq.Safe, true)
func DecodeSubscription(ctx context.Context, q sq.Queryable, r *sqlx.Rows) (Subscription, error) {
data, err := sq.ScanSingle[SubscriptionDB](ctx, q, r, sq.SModeFast, sq.Safe, true)
if err != nil {
return Subscription{}, err
}
return data.Model(), nil
}
func DecodeSubscriptions(r *sqlx.Rows) ([]Subscription, error) {
data, err := sq.ScanAll[SubscriptionDB](r, sq.SModeFast, sq.Safe, true)
func DecodeSubscriptions(ctx context.Context, q sq.Queryable, r *sqlx.Rows) ([]Subscription, error) {
data, err := sq.ScanAll[SubscriptionDB](ctx, q, r, sq.SModeFast, sq.Safe, true)
if err != nil {
return nil, err
}

View File

@ -2,6 +2,7 @@ package models
import (
scn "blackforestbytes.com/simplecloudnotifier"
"context"
"github.com/jmoiron/sqlx"
"gogs.mikescher.com/BlackForestBytes/goext/langext"
"gogs.mikescher.com/BlackForestBytes/goext/sq"
@ -171,16 +172,16 @@ func (u UserDB) Model() User {
}
}
func DecodeUser(r *sqlx.Rows) (User, error) {
data, err := sq.ScanSingle[UserDB](r, sq.SModeFast, sq.Safe, true)
func DecodeUser(ctx context.Context, q sq.Queryable, r *sqlx.Rows) (User, error) {
data, err := sq.ScanSingle[UserDB](ctx, q, r, sq.SModeFast, sq.Safe, true)
if err != nil {
return User{}, err
}
return data.Model(), nil
}
func DecodeUsers(r *sqlx.Rows) ([]User, error) {
data, err := sq.ScanAll[UserDB](r, sq.SModeFast, sq.Safe, true)
func DecodeUsers(ctx context.Context, q sq.Queryable, r *sqlx.Rows) ([]User, error) {
data, err := sq.ScanAll[UserDB](ctx, q, r, sq.SModeFast, sq.Safe, true)
if err != nil {
return nil, err
}

View File

@ -19,63 +19,39 @@
"parameters": [
{
"type": "string",
"example": "test",
"name": "channel",
"in": "query"
},
{
"type": "string",
"example": "This is a message",
"name": "content",
"in": "query"
},
{
"type": "string",
"example": "P3TNH8mvv14fm",
"name": "key",
"in": "query"
},
{
"type": "string",
"example": "db8b0e6a-a08c-4646",
"name": "msg_id",
"in": "query"
},
{
"enum": [
0,
1,
2
],
"type": "integer",
"example": 1,
"name": "priority",
"in": "query"
},
{
"type": "string",
"example": "example-server",
"name": "sender_name",
"in": "query"
},
{
"type": "number",
"example": 1669824037,
"name": "timestamp",
"in": "query"
},
{
"type": "string",
"example": "Hello World",
"name": "title",
"in": "query"
},
{
"type": "string",
"example": "7725",
"type": "integer",
"name": "user_id",
"in": "query"
},
{
"type": "string",
"name": "user_key",
"in": "query"
},
{
"description": " ",
"name": "post_body",
@ -86,62 +62,38 @@
},
{
"type": "string",
"example": "test",
"name": "channel",
"in": "formData"
},
{
"type": "string",
"example": "This is a message",
"name": "content",
"in": "formData"
},
{
"type": "string",
"example": "P3TNH8mvv14fm",
"name": "key",
"in": "formData"
},
{
"type": "string",
"example": "db8b0e6a-a08c-4646",
"name": "msg_id",
"in": "formData"
},
{
"enum": [
0,
1,
2
],
"type": "integer",
"example": 1,
"name": "priority",
"in": "formData"
},
{
"type": "string",
"example": "example-server",
"name": "sender_name",
"in": "formData"
},
{
"type": "number",
"example": 1669824037,
"name": "timestamp",
"in": "formData"
},
{
"type": "string",
"example": "Hello World",
"name": "title",
"in": "formData"
},
{
"type": "string",
"example": "7725",
"type": "integer",
"name": "user_id",
"in": "formData"
},
{
"type": "string",
"name": "user_key",
"in": "formData"
}
],
"responses": {
@ -2557,63 +2509,39 @@
"parameters": [
{
"type": "string",
"example": "test",
"name": "channel",
"in": "query"
},
{
"type": "string",
"example": "This is a message",
"name": "content",
"in": "query"
},
{
"type": "string",
"example": "P3TNH8mvv14fm",
"name": "key",
"in": "query"
},
{
"type": "string",
"example": "db8b0e6a-a08c-4646",
"name": "msg_id",
"in": "query"
},
{
"enum": [
0,
1,
2
],
"type": "integer",
"example": 1,
"name": "priority",
"in": "query"
},
{
"type": "string",
"example": "example-server",
"name": "sender_name",
"in": "query"
},
{
"type": "number",
"example": 1669824037,
"name": "timestamp",
"in": "query"
},
{
"type": "string",
"example": "Hello World",
"name": "title",
"in": "query"
},
{
"type": "string",
"example": "7725",
"type": "integer",
"name": "user_id",
"in": "query"
},
{
"type": "string",
"name": "user_key",
"in": "query"
},
{
"description": " ",
"name": "post_body",
@ -2624,62 +2552,38 @@
},
{
"type": "string",
"example": "test",
"name": "channel",
"in": "formData"
},
{
"type": "string",
"example": "This is a message",
"name": "content",
"in": "formData"
},
{
"type": "string",
"example": "P3TNH8mvv14fm",
"name": "key",
"in": "formData"
},
{
"type": "string",
"example": "db8b0e6a-a08c-4646",
"name": "msg_id",
"in": "formData"
},
{
"enum": [
0,
1,
2
],
"type": "integer",
"example": 1,
"name": "priority",
"in": "formData"
},
{
"type": "string",
"example": "example-server",
"name": "sender_name",
"in": "formData"
},
{
"type": "number",
"example": 1669824037,
"name": "timestamp",
"in": "formData"
},
{
"type": "string",
"example": "Hello World",
"name": "title",
"in": "formData"
},
{
"type": "string",
"example": "7725",
"type": "integer",
"name": "user_id",
"in": "formData"
},
{
"type": "string",
"name": "user_key",
"in": "formData"
}
],
"responses": {
@ -2727,121 +2631,73 @@
"parameters": [
{
"type": "string",
"example": "test",
"name": "channel",
"in": "query"
},
{
"type": "string",
"example": "This is a message",
"name": "content",
"in": "query"
},
{
"type": "string",
"example": "P3TNH8mvv14fm",
"name": "key",
"in": "query"
},
{
"type": "string",
"example": "db8b0e6a-a08c-4646",
"name": "msg_id",
"in": "query"
},
{
"enum": [
0,
1,
2
],
"type": "integer",
"example": 1,
"name": "priority",
"in": "query"
},
{
"type": "string",
"example": "example-server",
"name": "sender_name",
"in": "query"
},
{
"type": "number",
"example": 1669824037,
"name": "timestamp",
"in": "query"
},
{
"type": "string",
"example": "Hello World",
"name": "title",
"in": "query"
},
{
"type": "string",
"example": "7725",
"type": "integer",
"name": "user_id",
"in": "query"
},
{
"type": "string",
"example": "test",
"name": "channel",
"in": "formData"
"name": "user_key",
"in": "query"
},
{
"type": "string",
"example": "This is a message",
"name": "content",
"in": "formData"
},
{
"type": "string",
"example": "P3TNH8mvv14fm",
"name": "key",
"in": "formData"
},
{
"type": "string",
"example": "db8b0e6a-a08c-4646",
"name": "msg_id",
"in": "formData"
},
{
"enum": [
0,
1,
2
],
"type": "integer",
"example": 1,
"name": "priority",
"in": "formData"
},
{
"type": "string",
"example": "example-server",
"name": "sender_name",
"in": "formData"
},
{
"type": "number",
"example": 1669824037,
"name": "timestamp",
"in": "formData"
},
{
"type": "string",
"example": "Hello World",
"name": "title",
"in": "formData"
},
{
"type": "string",
"example": "7725",
"type": "integer",
"name": "user_id",
"in": "formData"
},
{
"type": "string",
"name": "user_key",
"in": "formData"
}
],
"responses": {
@ -3331,46 +3187,26 @@
"handler.SendMessage.combined": {
"type": "object",
"properties": {
"channel": {
"type": "string",
"example": "test"
},
"content": {
"type": "string",
"example": "This is a message"
},
"key": {
"type": "string",
"example": "P3TNH8mvv14fm"
"type": "string"
},
"msg_id": {
"type": "string",
"example": "db8b0e6a-a08c-4646"
"type": "string"
},
"priority": {
"type": "integer",
"enum": [
0,
1,
2
],
"example": 1
},
"sender_name": {
"type": "string",
"example": "example-server"
"type": "integer"
},
"timestamp": {
"type": "number",
"example": 1669824037
"type": "number"
},
"title": {
"type": "string",
"example": "Hello World"
"type": "string"
},
"user_id": {
"type": "string",
"example": "7725"
"type": "integer"
},
"user_key": {
"type": "string"
}
}
},
@ -3399,7 +3235,7 @@
"type": "integer"
},
"scn_msg_id": {
"type": "string"
"type": "integer"
},
"success": {
"type": "boolean"

View File

@ -323,36 +323,19 @@ definitions:
type: object
handler.SendMessage.combined:
properties:
channel:
example: test
type: string
content:
example: This is a message
type: string
key:
example: P3TNH8mvv14fm
type: string
msg_id:
example: db8b0e6a-a08c-4646
type: string
priority:
enum:
- 0
- 1
- 2
example: 1
type: integer
sender_name:
example: example-server
type: string
timestamp:
example: 1669824037
type: number
title:
example: Hello World
type: string
user_id:
example: "7725"
type: integer
user_key:
type: string
type: object
handler.SendMessage.response:
@ -372,7 +355,7 @@ definitions:
quota_max:
type: integer
scn_msg_id:
type: string
type: integer
success:
type: boolean
suppress_send:
@ -734,90 +717,52 @@ paths:
description: All parameter can be set via query-parameter or the json body.
Only UserID, UserKey and Title are required
parameters:
- example: test
in: query
name: channel
type: string
- example: This is a message
in: query
- in: query
name: content
type: string
- example: P3TNH8mvv14fm
in: query
name: key
type: string
- example: db8b0e6a-a08c-4646
in: query
- in: query
name: msg_id
type: string
- enum:
- 0
- 1
- 2
example: 1
in: query
- in: query
name: priority
type: integer
- example: example-server
in: query
name: sender_name
type: string
- example: 1669824037
in: query
- in: query
name: timestamp
type: number
- example: Hello World
in: query
- in: query
name: title
type: string
- example: "7725"
in: query
- in: query
name: user_id
type: integer
- in: query
name: user_key
type: string
- description: ' '
in: body
name: post_body
schema:
$ref: '#/definitions/handler.SendMessage.combined'
- example: test
in: formData
name: channel
type: string
- example: This is a message
in: formData
- in: formData
name: content
type: string
- example: P3TNH8mvv14fm
in: formData
name: key
type: string
- example: db8b0e6a-a08c-4646
in: formData
- in: formData
name: msg_id
type: string
- enum:
- 0
- 1
- 2
example: 1
in: formData
- in: formData
name: priority
type: integer
- example: example-server
in: formData
name: sender_name
type: string
- example: 1669824037
in: formData
- in: formData
name: timestamp
type: number
- example: Hello World
in: formData
- in: formData
name: title
type: string
- example: "7725"
in: formData
- in: formData
name: user_id
type: integer
- in: formData
name: user_key
type: string
responses:
"200":
@ -2475,90 +2420,52 @@ paths:
description: All parameter can be set via query-parameter or the json body.
Only UserID, UserKey and Title are required
parameters:
- example: test
in: query
name: channel
type: string
- example: This is a message
in: query
- in: query
name: content
type: string
- example: P3TNH8mvv14fm
in: query
name: key
type: string
- example: db8b0e6a-a08c-4646
in: query
- in: query
name: msg_id
type: string
- enum:
- 0
- 1
- 2
example: 1
in: query
- in: query
name: priority
type: integer
- example: example-server
in: query
name: sender_name
type: string
- example: 1669824037
in: query
- in: query
name: timestamp
type: number
- example: Hello World
in: query
- in: query
name: title
type: string
- example: "7725"
in: query
- in: query
name: user_id
type: integer
- in: query
name: user_key
type: string
- description: ' '
in: body
name: post_body
schema:
$ref: '#/definitions/handler.SendMessage.combined'
- example: test
in: formData
name: channel
type: string
- example: This is a message
in: formData
- in: formData
name: content
type: string
- example: P3TNH8mvv14fm
in: formData
name: key
type: string
- example: db8b0e6a-a08c-4646
in: formData
- in: formData
name: msg_id
type: string
- enum:
- 0
- 1
- 2
example: 1
in: formData
- in: formData
name: priority
type: integer
- example: example-server
in: formData
name: sender_name
type: string
- example: 1669824037
in: formData
- in: formData
name: timestamp
type: number
- example: Hello World
in: formData
- in: formData
name: title
type: string
- example: "7725"
in: formData
- in: formData
name: user_id
type: integer
- in: formData
name: user_key
type: string
responses:
"200":
@ -2591,85 +2498,47 @@ paths:
description: All parameter can be set via query-parameter or form-data body.
Only UserID, UserKey and Title are required
parameters:
- example: test
in: query
name: channel
type: string
- example: This is a message
in: query
- in: query
name: content
type: string
- example: P3TNH8mvv14fm
in: query
name: key
type: string
- example: db8b0e6a-a08c-4646
in: query
- in: query
name: msg_id
type: string
- enum:
- 0
- 1
- 2
example: 1
in: query
- in: query
name: priority
type: integer
- example: example-server
in: query
name: sender_name
type: string
- example: 1669824037
in: query
- in: query
name: timestamp
type: number
- example: Hello World
in: query
- in: query
name: title
type: string
- example: "7725"
in: query
- in: query
name: user_id
type: integer
- in: query
name: user_key
type: string
- example: test
in: formData
name: channel
type: string
- example: This is a message
in: formData
- in: formData
name: content
type: string
- example: P3TNH8mvv14fm
in: formData
name: key
type: string
- example: db8b0e6a-a08c-4646
in: formData
- in: formData
name: msg_id
type: string
- enum:
- 0
- 1
- 2
example: 1
in: formData
- in: formData
name: priority
type: integer
- example: example-server
in: formData
name: sender_name
type: string
- example: 1669824037
in: formData
- in: formData
name: timestamp
type: number
- example: Hello World
in: formData
- in: formData
name: title
type: string
- example: "7725"
in: formData
- in: formData
name: user_id
type: integer
- in: formData
name: user_key
type: string
responses:
"200":

View File

@ -310,7 +310,7 @@ func TestPrimaryDB_Migrate_from_3(t *testing.T) {
xdb, err := sqlx.Open("sqlite3", url)
tt.TestFailIfErr(t, err)
qqdb := sq.NewDB(xdb)
qqdb := sq.NewDB(xdb, sq.DBOptions{})
schemavers := 3

View File

@ -0,0 +1,15 @@
package test
import (
"gogs.mikescher.com/BlackForestBytes/goext/exerr"
"gogs.mikescher.com/BlackForestBytes/goext/langext"
"os"
"testing"
)
func TestMain(m *testing.M) {
if !exerr.Initialized() {
exerr.Init(exerr.ErrorPackageConfigInit{ZeroLogErrTraces: langext.PFalse, ZeroLogAllTraces: langext.PFalse})
}
os.Exit(m.Run())
}