diff --git a/sam/channel.structs.go b/sam/channel.structs.go index 54debacbf..c8a08b252 100644 --- a/sam/channel.structs.go +++ b/sam/channel.structs.go @@ -16,6 +16,7 @@ package sam */ import ( + "encoding/json" "time" ) @@ -25,9 +26,10 @@ type ( ID uint64 Name string Topic string - LastMessageId uint64 `json:",omitempty"` - ArchivedAt *time.Time `json:",omitempty"` - DeletedAt *time.Time `json:",omitempty"` + Meta json.RawMessage + LastMessageId uint64 `json:",omitempty" db:"rel_last_message"` + ArchivedAt *time.Time `json:",omitempty" db:"archived_at"` + DeletedAt *time.Time `json:",omitempty" db:"deleted_at"` changed []string } @@ -72,6 +74,14 @@ func (c *Channel) SetTopic(value string) *Channel { } return c } +func (c *Channel) GetMeta() json.RawMessage { + return c.Meta +} + +func (c *Channel) SetMeta(value json.RawMessage) *Channel { + c.Meta = value + return c +} func (c *Channel) GetLastMessageId() uint64 { return c.LastMessageId } diff --git a/sam/docs/src/spec.json b/sam/docs/src/spec.json index 373c87825..362b9dc19 100644 --- a/sam/docs/src/spec.json +++ b/sam/docs/src/spec.json @@ -178,15 +178,17 @@ { "name": "Channel", "imports": [ - "time" + "time", + "encoding/json" ], "fields": [ - { "type": "uint64", "name": "ID" }, - { "type": "string", "name": "Name" }, - { "type": "string", "name": "Topic" }, - { "type": "uint64", "name": "LastMessageId", "tag": "json:\",omitempty\"" }, - { "type": "*time.Time", "name": "ArchivedAt", "tag": "json:\",omitempty\"", "complex": true }, - { "type": "*time.Time", "name": "DeletedAt", "tag": "json:\",omitempty\"", "complex": true } + { "type": "uint64", "name": "ID" }, + { "type": "string", "name": "Name" }, + { "type": "string", "name": "Topic" }, + { "type": "json.RawMessage", "name": "Meta", "complex": true}, + { "type": "uint64", "name": "LastMessageId", "tag": "json:\",omitempty\"", "dbname": "rel_last_message" }, + { "type": "*time.Time", "name": "ArchivedAt", "tag": "json:\",omitempty\" db:\"archived_at\"", "complex": true }, + { "type": "*time.Time", "name": "DeletedAt", "tag": "json:\",omitempty\" db:\"deleted_at\"", "complex": true } ] } ], diff --git a/sam/docs/src/spec/channel.json b/sam/docs/src/spec/channel.json index 949338f0f..faac80310 100644 --- a/sam/docs/src/spec/channel.json +++ b/sam/docs/src/spec/channel.json @@ -19,6 +19,12 @@ "type": "string" }, { + "complex": true, + "name": "Meta", + "type": "json.RawMessage" + }, + { + "dbname": "rel_last_message", "name": "LastMessageId", "tag": "json:\",omitempty\"", "type": "uint64" @@ -26,18 +32,19 @@ { "complex": true, "name": "ArchivedAt", - "tag": "json:\",omitempty\"", + "tag": "json:\",omitempty\" db:\"archived_at\"", "type": "*time.Time" }, { "complex": true, "name": "DeletedAt", - "tag": "json:\",omitempty\"", + "tag": "json:\",omitempty\" db:\"deleted_at\"", "type": "*time.Time" } ], "imports": [ - "time" + "time", + "encoding/json" ], "name": "Channel" }