Compare commits

...
Author SHA1 Message Date
phoenix def82c5d61 Code formatting 2025-11-30 17:40:33 -05:00
phoenix d5dae37aef Added type for handling json types 2025-11-30 17:39:53 -05:00
phoenix 64c610597a Code formatting 2025-11-29 16:20:01 -05:00
phoenix 6863af47c3 Version bump 2025-11-29 16:19:44 -05:00
phoenix 05e830a824 Added MessageEventResponse 2025-11-29 16:19:36 -05:00
3 changed files with 59 additions and 1 deletions
+1 -1
View File
@@ -25,7 +25,7 @@ jobs:
run: |
echo "Creating version"
VERSION="0.0.10"
VERSION="0.0.11"
PROJECT_COMMIT_HASH=$(git rev-parse HEAD | cut -c 1-10)
BRANCH_REF="${{ gitea.ref }}"
BRANCH_NAME=$(echo "$BRANCH_REF" | cut -d '/' -f 3)
+17
View File
@@ -0,0 +1,17 @@
package message
import (
"time"
"github.com/google/uuid"
"git.kundeng.us/phoenix/textsender-models/tx0/types"
)
type MessageEventResponse struct {
Id uuid.UUID `json:"id,omitempty"`
ScheduledMessageEventId uuid.UUID `json:"scheduled_message_event_id,omitempty"`
Response types.JSONB `json:"response"`
UserId uuid.UUID `json:"user_id,omitempty"`
Sent time.Time `json:"sent"`
}
+41
View File
@@ -0,0 +1,41 @@
package types
import (
"database/sql/driver"
"encoding/json"
"fmt"
)
type JSONB json.RawMessage
// Scan implements sql.Scanner
func (j *JSONB) Scan(value interface{}) error {
if value == nil {
*j = nil
return nil
}
var data []byte
switch v := value.(type) {
case []byte:
// pgx may pass data as []byte in binary format
data = v
case string:
// pgx may pass data as string in text format
data = []byte(v)
default:
return fmt.Errorf("unsupported type: %T", v)
}
*j = JSONB(data)
return nil
}
// Value implements driver.Valuer
func (j JSONB) Value() (driver.Value, error) {
if j == nil {
return nil, nil
} else {
return []byte(j), nil
}
}