upd(generator): add docs from spec files
This commit is contained in:
@@ -17,7 +17,7 @@ type ({foreach $structs as $struct}
|
||||
{field}{newline}
|
||||
{/foreach}
|
||||
{else}
|
||||
// {api.title}
|
||||
// {api.title} - {api.description}
|
||||
{struct.name} struct {
|
||||
{foreach $struct.fields as $field}
|
||||
{field.name} {field.type} `{if $field.tag}{$field.tag} {/if}db:"{if $field.dbname}{$field.dbname}{else}{$field.name|decamel}{/if}"`{newline}
|
||||
@@ -29,30 +29,37 @@ type ({foreach $structs as $struct}
|
||||
{/if}{/foreach}
|
||||
)
|
||||
|
||||
/* Constructors */
|
||||
{foreach $structs as $struct}
|
||||
// New constructs a new instance of {struct.name}
|
||||
func ({struct.name}) New() *{struct.name} {
|
||||
return &{struct.name}{}
|
||||
}
|
||||
{/foreach}
|
||||
|
||||
/* Getters/setters */
|
||||
{foreach $structs as $struct}
|
||||
{foreach $struct.fields as $field}
|
||||
// Get the value of {field.name}
|
||||
func ({self} *{struct.name}) Get{field.name}() {field.type} {
|
||||
return {self}.{field.name}
|
||||
}
|
||||
|
||||
// Set the value of {field.name}
|
||||
func ({self} *{struct.name}) Set{field.name}(value {field.type}) *{struct.name} {{if !$field.complex}
|
||||
if {self}.{field.name} != value {
|
||||
{self}.changed = append({self}.changed, "{field.name}")
|
||||
{self}.{field.name} = value
|
||||
}
|
||||
{else}
|
||||
{self}.changed = append({self}.changed, "{field.name}")
|
||||
{self}.{field.name} = value
|
||||
{/if}
|
||||
return {self}
|
||||
}
|
||||
{/foreach}
|
||||
|
||||
// Changes returns the names of changed fields
|
||||
func ({self} *{struct.name}) Changes() []string {
|
||||
return {self}.changed
|
||||
}
|
||||
|
||||
{/foreach}
|
||||
|
||||
+12
-3
@@ -16,7 +16,7 @@ package types
|
||||
*/
|
||||
|
||||
type (
|
||||
// Fields
|
||||
// Fields - CRM input field definitions
|
||||
Field struct {
|
||||
Name string `json:"name" db:"name"`
|
||||
Type string `json:"type" db:"type"`
|
||||
@@ -25,16 +25,17 @@ type (
|
||||
}
|
||||
)
|
||||
|
||||
/* Constructors */
|
||||
// New constructs a new instance of Field
|
||||
func (Field) New() *Field {
|
||||
return &Field{}
|
||||
}
|
||||
|
||||
/* Getters/setters */
|
||||
// Get the value of Name
|
||||
func (f *Field) GetName() string {
|
||||
return f.Name
|
||||
}
|
||||
|
||||
// Set the value of Name
|
||||
func (f *Field) SetName(value string) *Field {
|
||||
if f.Name != value {
|
||||
f.changed = append(f.changed, "Name")
|
||||
@@ -42,10 +43,13 @@ func (f *Field) SetName(value string) *Field {
|
||||
}
|
||||
return f
|
||||
}
|
||||
|
||||
// Get the value of Type
|
||||
func (f *Field) GetType() string {
|
||||
return f.Type
|
||||
}
|
||||
|
||||
// Set the value of Type
|
||||
func (f *Field) SetType(value string) *Field {
|
||||
if f.Type != value {
|
||||
f.changed = append(f.changed, "Type")
|
||||
@@ -53,3 +57,8 @@ func (f *Field) SetType(value string) *Field {
|
||||
}
|
||||
return f
|
||||
}
|
||||
|
||||
// Changes returns the names of changed fields
|
||||
func (f *Field) Changes() []string {
|
||||
return f.changed
|
||||
}
|
||||
|
||||
+30
-4
@@ -20,7 +20,7 @@ import (
|
||||
)
|
||||
|
||||
type (
|
||||
// Modules
|
||||
// Modules - CRM module definitions
|
||||
Module struct {
|
||||
ID uint64 `db:"id"`
|
||||
Name string `db:"name"`
|
||||
@@ -28,7 +28,7 @@ type (
|
||||
changed []string
|
||||
}
|
||||
|
||||
// Modules
|
||||
// Modules - CRM module definitions
|
||||
ModuleContentRow struct {
|
||||
ID uint64 `db:"id" db:"id"`
|
||||
ModuleID uint64 `db:"module_id" db:"module_id"`
|
||||
@@ -38,19 +38,22 @@ type (
|
||||
}
|
||||
)
|
||||
|
||||
/* Constructors */
|
||||
// New constructs a new instance of Module
|
||||
func (Module) New() *Module {
|
||||
return &Module{}
|
||||
}
|
||||
|
||||
// New constructs a new instance of ModuleContentRow
|
||||
func (ModuleContentRow) New() *ModuleContentRow {
|
||||
return &ModuleContentRow{}
|
||||
}
|
||||
|
||||
/* Getters/setters */
|
||||
// Get the value of ID
|
||||
func (m *Module) GetID() uint64 {
|
||||
return m.ID
|
||||
}
|
||||
|
||||
// Set the value of ID
|
||||
func (m *Module) SetID(value uint64) *Module {
|
||||
if m.ID != value {
|
||||
m.changed = append(m.changed, "ID")
|
||||
@@ -58,10 +61,13 @@ func (m *Module) SetID(value uint64) *Module {
|
||||
}
|
||||
return m
|
||||
}
|
||||
|
||||
// Get the value of Name
|
||||
func (m *Module) GetName() string {
|
||||
return m.Name
|
||||
}
|
||||
|
||||
// Set the value of Name
|
||||
func (m *Module) SetName(value string) *Module {
|
||||
if m.Name != value {
|
||||
m.changed = append(m.changed, "Name")
|
||||
@@ -69,10 +75,18 @@ func (m *Module) SetName(value string) *Module {
|
||||
}
|
||||
return m
|
||||
}
|
||||
|
||||
// Changes returns the names of changed fields
|
||||
func (m *Module) Changes() []string {
|
||||
return m.changed
|
||||
}
|
||||
|
||||
// Get the value of ID
|
||||
func (m *ModuleContentRow) GetID() uint64 {
|
||||
return m.ID
|
||||
}
|
||||
|
||||
// Set the value of ID
|
||||
func (m *ModuleContentRow) SetID(value uint64) *ModuleContentRow {
|
||||
if m.ID != value {
|
||||
m.changed = append(m.changed, "ID")
|
||||
@@ -80,10 +94,13 @@ func (m *ModuleContentRow) SetID(value uint64) *ModuleContentRow {
|
||||
}
|
||||
return m
|
||||
}
|
||||
|
||||
// Get the value of ModuleID
|
||||
func (m *ModuleContentRow) GetModuleID() uint64 {
|
||||
return m.ModuleID
|
||||
}
|
||||
|
||||
// Set the value of ModuleID
|
||||
func (m *ModuleContentRow) SetModuleID(value uint64) *ModuleContentRow {
|
||||
if m.ModuleID != value {
|
||||
m.changed = append(m.changed, "ModuleID")
|
||||
@@ -91,11 +108,20 @@ func (m *ModuleContentRow) SetModuleID(value uint64) *ModuleContentRow {
|
||||
}
|
||||
return m
|
||||
}
|
||||
|
||||
// Get the value of Fields
|
||||
func (m *ModuleContentRow) GetFields() types.JSONText {
|
||||
return m.Fields
|
||||
}
|
||||
|
||||
// Set the value of Fields
|
||||
func (m *ModuleContentRow) SetFields(value types.JSONText) *ModuleContentRow {
|
||||
m.changed = append(m.changed, "Fields")
|
||||
m.Fields = value
|
||||
return m
|
||||
}
|
||||
|
||||
// Changes returns the names of changed fields
|
||||
func (m *ModuleContentRow) Changes() []string {
|
||||
return m.changed
|
||||
}
|
||||
|
||||
+30
-3
@@ -21,7 +21,7 @@ import (
|
||||
)
|
||||
|
||||
type (
|
||||
// Channels
|
||||
// Channels - A channel is a representation of a sequence of messages. It has meta data like channel subject. Channels may be public, private or direct (between two users).
|
||||
Channel struct {
|
||||
ID uint64 `db:"id"`
|
||||
Name string `db:"name"`
|
||||
@@ -35,16 +35,17 @@ type (
|
||||
}
|
||||
)
|
||||
|
||||
/* Constructors */
|
||||
// New constructs a new instance of Channel
|
||||
func (Channel) New() *Channel {
|
||||
return &Channel{}
|
||||
}
|
||||
|
||||
/* Getters/setters */
|
||||
// Get the value of ID
|
||||
func (c *Channel) GetID() uint64 {
|
||||
return c.ID
|
||||
}
|
||||
|
||||
// Set the value of ID
|
||||
func (c *Channel) SetID(value uint64) *Channel {
|
||||
if c.ID != value {
|
||||
c.changed = append(c.changed, "ID")
|
||||
@@ -52,10 +53,13 @@ func (c *Channel) SetID(value uint64) *Channel {
|
||||
}
|
||||
return c
|
||||
}
|
||||
|
||||
// Get the value of Name
|
||||
func (c *Channel) GetName() string {
|
||||
return c.Name
|
||||
}
|
||||
|
||||
// Set the value of Name
|
||||
func (c *Channel) SetName(value string) *Channel {
|
||||
if c.Name != value {
|
||||
c.changed = append(c.changed, "Name")
|
||||
@@ -63,10 +67,13 @@ func (c *Channel) SetName(value string) *Channel {
|
||||
}
|
||||
return c
|
||||
}
|
||||
|
||||
// Get the value of Topic
|
||||
func (c *Channel) GetTopic() string {
|
||||
return c.Topic
|
||||
}
|
||||
|
||||
// Set the value of Topic
|
||||
func (c *Channel) SetTopic(value string) *Channel {
|
||||
if c.Topic != value {
|
||||
c.changed = append(c.changed, "Topic")
|
||||
@@ -74,18 +81,25 @@ func (c *Channel) SetTopic(value string) *Channel {
|
||||
}
|
||||
return c
|
||||
}
|
||||
|
||||
// Get the value of Meta
|
||||
func (c *Channel) GetMeta() json.RawMessage {
|
||||
return c.Meta
|
||||
}
|
||||
|
||||
// Set the value of Meta
|
||||
func (c *Channel) SetMeta(value json.RawMessage) *Channel {
|
||||
c.changed = append(c.changed, "Meta")
|
||||
c.Meta = value
|
||||
return c
|
||||
}
|
||||
|
||||
// Get the value of LastMessageId
|
||||
func (c *Channel) GetLastMessageId() uint64 {
|
||||
return c.LastMessageId
|
||||
}
|
||||
|
||||
// Set the value of LastMessageId
|
||||
func (c *Channel) SetLastMessageId(value uint64) *Channel {
|
||||
if c.LastMessageId != value {
|
||||
c.changed = append(c.changed, "LastMessageId")
|
||||
@@ -93,19 +107,32 @@ func (c *Channel) SetLastMessageId(value uint64) *Channel {
|
||||
}
|
||||
return c
|
||||
}
|
||||
|
||||
// Get the value of ArchivedAt
|
||||
func (c *Channel) GetArchivedAt() *time.Time {
|
||||
return c.ArchivedAt
|
||||
}
|
||||
|
||||
// Set the value of ArchivedAt
|
||||
func (c *Channel) SetArchivedAt(value *time.Time) *Channel {
|
||||
c.changed = append(c.changed, "ArchivedAt")
|
||||
c.ArchivedAt = value
|
||||
return c
|
||||
}
|
||||
|
||||
// Get the value of DeletedAt
|
||||
func (c *Channel) GetDeletedAt() *time.Time {
|
||||
return c.DeletedAt
|
||||
}
|
||||
|
||||
// Set the value of DeletedAt
|
||||
func (c *Channel) SetDeletedAt(value *time.Time) *Channel {
|
||||
c.changed = append(c.changed, "DeletedAt")
|
||||
c.DeletedAt = value
|
||||
return c
|
||||
}
|
||||
|
||||
// Changes returns the names of changed fields
|
||||
func (c *Channel) Changes() []string {
|
||||
return c.changed
|
||||
}
|
||||
|
||||
+34
-3
@@ -16,7 +16,7 @@ package types
|
||||
*/
|
||||
|
||||
type (
|
||||
// Messages
|
||||
// Messages -
|
||||
Message struct {
|
||||
Service string `db:"service"`
|
||||
Channel string `db:"channel"`
|
||||
@@ -32,16 +32,17 @@ type (
|
||||
}
|
||||
)
|
||||
|
||||
/* Constructors */
|
||||
// New constructs a new instance of Message
|
||||
func (Message) New() *Message {
|
||||
return &Message{}
|
||||
}
|
||||
|
||||
/* Getters/setters */
|
||||
// Get the value of Service
|
||||
func (m *Message) GetService() string {
|
||||
return m.Service
|
||||
}
|
||||
|
||||
// Set the value of Service
|
||||
func (m *Message) SetService(value string) *Message {
|
||||
if m.Service != value {
|
||||
m.changed = append(m.changed, "Service")
|
||||
@@ -49,10 +50,13 @@ func (m *Message) SetService(value string) *Message {
|
||||
}
|
||||
return m
|
||||
}
|
||||
|
||||
// Get the value of Channel
|
||||
func (m *Message) GetChannel() string {
|
||||
return m.Channel
|
||||
}
|
||||
|
||||
// Set the value of Channel
|
||||
func (m *Message) SetChannel(value string) *Message {
|
||||
if m.Channel != value {
|
||||
m.changed = append(m.changed, "Channel")
|
||||
@@ -60,10 +64,13 @@ func (m *Message) SetChannel(value string) *Message {
|
||||
}
|
||||
return m
|
||||
}
|
||||
|
||||
// Get the value of UserName
|
||||
func (m *Message) GetUserName() string {
|
||||
return m.UserName
|
||||
}
|
||||
|
||||
// Set the value of UserName
|
||||
func (m *Message) SetUserName(value string) *Message {
|
||||
if m.UserName != value {
|
||||
m.changed = append(m.changed, "UserName")
|
||||
@@ -71,10 +78,13 @@ func (m *Message) SetUserName(value string) *Message {
|
||||
}
|
||||
return m
|
||||
}
|
||||
|
||||
// Get the value of UserID
|
||||
func (m *Message) GetUserID() uint64 {
|
||||
return m.UserID
|
||||
}
|
||||
|
||||
// Set the value of UserID
|
||||
func (m *Message) SetUserID(value uint64) *Message {
|
||||
if m.UserID != value {
|
||||
m.changed = append(m.changed, "UserID")
|
||||
@@ -82,18 +92,25 @@ func (m *Message) SetUserID(value uint64) *Message {
|
||||
}
|
||||
return m
|
||||
}
|
||||
|
||||
// Get the value of User
|
||||
func (m *Message) GetUser() *User {
|
||||
return m.User
|
||||
}
|
||||
|
||||
// Set the value of User
|
||||
func (m *Message) SetUser(value *User) *Message {
|
||||
m.changed = append(m.changed, "User")
|
||||
m.User = value
|
||||
return m
|
||||
}
|
||||
|
||||
// Get the value of UserAvatar
|
||||
func (m *Message) GetUserAvatar() string {
|
||||
return m.UserAvatar
|
||||
}
|
||||
|
||||
// Set the value of UserAvatar
|
||||
func (m *Message) SetUserAvatar(value string) *Message {
|
||||
if m.UserAvatar != value {
|
||||
m.changed = append(m.changed, "UserAvatar")
|
||||
@@ -101,10 +118,13 @@ func (m *Message) SetUserAvatar(value string) *Message {
|
||||
}
|
||||
return m
|
||||
}
|
||||
|
||||
// Get the value of Message
|
||||
func (m *Message) GetMessage() string {
|
||||
return m.Message
|
||||
}
|
||||
|
||||
// Set the value of Message
|
||||
func (m *Message) SetMessage(value string) *Message {
|
||||
if m.Message != value {
|
||||
m.changed = append(m.changed, "Message")
|
||||
@@ -112,10 +132,13 @@ func (m *Message) SetMessage(value string) *Message {
|
||||
}
|
||||
return m
|
||||
}
|
||||
|
||||
// Get the value of MessageID
|
||||
func (m *Message) GetMessageID() string {
|
||||
return m.MessageID
|
||||
}
|
||||
|
||||
// Set the value of MessageID
|
||||
func (m *Message) SetMessageID(value string) *Message {
|
||||
if m.MessageID != value {
|
||||
m.changed = append(m.changed, "MessageID")
|
||||
@@ -123,10 +146,13 @@ func (m *Message) SetMessageID(value string) *Message {
|
||||
}
|
||||
return m
|
||||
}
|
||||
|
||||
// Get the value of Type
|
||||
func (m *Message) GetType() MessageType {
|
||||
return m.Type
|
||||
}
|
||||
|
||||
// Set the value of Type
|
||||
func (m *Message) SetType(value MessageType) *Message {
|
||||
if m.Type != value {
|
||||
m.changed = append(m.changed, "Type")
|
||||
@@ -134,3 +160,8 @@ func (m *Message) SetType(value MessageType) *Message {
|
||||
}
|
||||
return m
|
||||
}
|
||||
|
||||
// Changes returns the names of changed fields
|
||||
func (m *Message) Changes() []string {
|
||||
return m.changed
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ import (
|
||||
)
|
||||
|
||||
type (
|
||||
// Organisations
|
||||
// Organisations - Organisations represent a top-level grouping entity. There may be many organisations defined in a single deployment.
|
||||
Organisation struct {
|
||||
ID uint64 `db:"id"`
|
||||
Name string `db:"name"`
|
||||
@@ -31,16 +31,17 @@ type (
|
||||
}
|
||||
)
|
||||
|
||||
/* Constructors */
|
||||
// New constructs a new instance of Organisation
|
||||
func (Organisation) New() *Organisation {
|
||||
return &Organisation{}
|
||||
}
|
||||
|
||||
/* Getters/setters */
|
||||
// Get the value of ID
|
||||
func (o *Organisation) GetID() uint64 {
|
||||
return o.ID
|
||||
}
|
||||
|
||||
// Set the value of ID
|
||||
func (o *Organisation) SetID(value uint64) *Organisation {
|
||||
if o.ID != value {
|
||||
o.changed = append(o.changed, "ID")
|
||||
@@ -48,10 +49,13 @@ func (o *Organisation) SetID(value uint64) *Organisation {
|
||||
}
|
||||
return o
|
||||
}
|
||||
|
||||
// Get the value of Name
|
||||
func (o *Organisation) GetName() string {
|
||||
return o.Name
|
||||
}
|
||||
|
||||
// Set the value of Name
|
||||
func (o *Organisation) SetName(value string) *Organisation {
|
||||
if o.Name != value {
|
||||
o.changed = append(o.changed, "Name")
|
||||
@@ -59,19 +63,32 @@ func (o *Organisation) SetName(value string) *Organisation {
|
||||
}
|
||||
return o
|
||||
}
|
||||
|
||||
// Get the value of ArchivedAt
|
||||
func (o *Organisation) GetArchivedAt() *time.Time {
|
||||
return o.ArchivedAt
|
||||
}
|
||||
|
||||
// Set the value of ArchivedAt
|
||||
func (o *Organisation) SetArchivedAt(value *time.Time) *Organisation {
|
||||
o.changed = append(o.changed, "ArchivedAt")
|
||||
o.ArchivedAt = value
|
||||
return o
|
||||
}
|
||||
|
||||
// Get the value of DeletedAt
|
||||
func (o *Organisation) GetDeletedAt() *time.Time {
|
||||
return o.DeletedAt
|
||||
}
|
||||
|
||||
// Set the value of DeletedAt
|
||||
func (o *Organisation) SetDeletedAt(value *time.Time) *Organisation {
|
||||
o.changed = append(o.changed, "DeletedAt")
|
||||
o.DeletedAt = value
|
||||
return o
|
||||
}
|
||||
|
||||
// Changes returns the names of changed fields
|
||||
func (o *Organisation) Changes() []string {
|
||||
return o.changed
|
||||
}
|
||||
|
||||
+28
-3
@@ -20,7 +20,7 @@ import (
|
||||
)
|
||||
|
||||
type (
|
||||
// Teams
|
||||
// Teams - An organisation may have many teams. Teams may have many channels available. Access to channels may be shared between teams.
|
||||
Team struct {
|
||||
ID uint64 `db:"id"`
|
||||
Name string `db:"name"`
|
||||
@@ -33,16 +33,17 @@ type (
|
||||
}
|
||||
)
|
||||
|
||||
/* Constructors */
|
||||
// New constructs a new instance of Team
|
||||
func (Team) New() *Team {
|
||||
return &Team{}
|
||||
}
|
||||
|
||||
/* Getters/setters */
|
||||
// Get the value of ID
|
||||
func (t *Team) GetID() uint64 {
|
||||
return t.ID
|
||||
}
|
||||
|
||||
// Set the value of ID
|
||||
func (t *Team) SetID(value uint64) *Team {
|
||||
if t.ID != value {
|
||||
t.changed = append(t.changed, "ID")
|
||||
@@ -50,10 +51,13 @@ func (t *Team) SetID(value uint64) *Team {
|
||||
}
|
||||
return t
|
||||
}
|
||||
|
||||
// Get the value of Name
|
||||
func (t *Team) GetName() string {
|
||||
return t.Name
|
||||
}
|
||||
|
||||
// Set the value of Name
|
||||
func (t *Team) SetName(value string) *Team {
|
||||
if t.Name != value {
|
||||
t.changed = append(t.changed, "Name")
|
||||
@@ -61,35 +65,56 @@ func (t *Team) SetName(value string) *Team {
|
||||
}
|
||||
return t
|
||||
}
|
||||
|
||||
// Get the value of MemberIDs
|
||||
func (t *Team) GetMemberIDs() []uint64 {
|
||||
return t.MemberIDs
|
||||
}
|
||||
|
||||
// Set the value of MemberIDs
|
||||
func (t *Team) SetMemberIDs(value []uint64) *Team {
|
||||
t.changed = append(t.changed, "MemberIDs")
|
||||
t.MemberIDs = value
|
||||
return t
|
||||
}
|
||||
|
||||
// Get the value of Members
|
||||
func (t *Team) GetMembers() []User {
|
||||
return t.Members
|
||||
}
|
||||
|
||||
// Set the value of Members
|
||||
func (t *Team) SetMembers(value []User) *Team {
|
||||
t.changed = append(t.changed, "Members")
|
||||
t.Members = value
|
||||
return t
|
||||
}
|
||||
|
||||
// Get the value of ArchivedAt
|
||||
func (t *Team) GetArchivedAt() *time.Time {
|
||||
return t.ArchivedAt
|
||||
}
|
||||
|
||||
// Set the value of ArchivedAt
|
||||
func (t *Team) SetArchivedAt(value *time.Time) *Team {
|
||||
t.changed = append(t.changed, "ArchivedAt")
|
||||
t.ArchivedAt = value
|
||||
return t
|
||||
}
|
||||
|
||||
// Get the value of DeletedAt
|
||||
func (t *Team) GetDeletedAt() *time.Time {
|
||||
return t.DeletedAt
|
||||
}
|
||||
|
||||
// Set the value of DeletedAt
|
||||
func (t *Team) SetDeletedAt(value *time.Time) *Team {
|
||||
t.changed = append(t.changed, "DeletedAt")
|
||||
t.DeletedAt = value
|
||||
return t
|
||||
}
|
||||
|
||||
// Changes returns the names of changed fields
|
||||
func (t *Team) Changes() []string {
|
||||
return t.changed
|
||||
}
|
||||
|
||||
+30
-3
@@ -20,7 +20,7 @@ import (
|
||||
)
|
||||
|
||||
type (
|
||||
// Users
|
||||
// Users -
|
||||
User struct {
|
||||
ID uint64 `db:"id"`
|
||||
Username string `db:"username"`
|
||||
@@ -34,16 +34,17 @@ type (
|
||||
}
|
||||
)
|
||||
|
||||
/* Constructors */
|
||||
// New constructs a new instance of User
|
||||
func (User) New() *User {
|
||||
return &User{}
|
||||
}
|
||||
|
||||
/* Getters/setters */
|
||||
// Get the value of ID
|
||||
func (u *User) GetID() uint64 {
|
||||
return u.ID
|
||||
}
|
||||
|
||||
// Set the value of ID
|
||||
func (u *User) SetID(value uint64) *User {
|
||||
if u.ID != value {
|
||||
u.changed = append(u.changed, "ID")
|
||||
@@ -51,10 +52,13 @@ func (u *User) SetID(value uint64) *User {
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
// Get the value of Username
|
||||
func (u *User) GetUsername() string {
|
||||
return u.Username
|
||||
}
|
||||
|
||||
// Set the value of Username
|
||||
func (u *User) SetUsername(value string) *User {
|
||||
if u.Username != value {
|
||||
u.changed = append(u.changed, "Username")
|
||||
@@ -62,10 +66,13 @@ func (u *User) SetUsername(value string) *User {
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
// Get the value of Meta
|
||||
func (u *User) GetMeta() interface{} {
|
||||
return u.Meta
|
||||
}
|
||||
|
||||
// Set the value of Meta
|
||||
func (u *User) SetMeta(value interface{}) *User {
|
||||
if u.Meta != value {
|
||||
u.changed = append(u.changed, "Meta")
|
||||
@@ -73,10 +80,13 @@ func (u *User) SetMeta(value interface{}) *User {
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
// Get the value of OrganisationID
|
||||
func (u *User) GetOrganisationID() uint64 {
|
||||
return u.OrganisationID
|
||||
}
|
||||
|
||||
// Set the value of OrganisationID
|
||||
func (u *User) SetOrganisationID(value uint64) *User {
|
||||
if u.OrganisationID != value {
|
||||
u.changed = append(u.changed, "OrganisationID")
|
||||
@@ -84,27 +94,44 @@ func (u *User) SetOrganisationID(value uint64) *User {
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
// Get the value of Password
|
||||
func (u *User) GetPassword() []byte {
|
||||
return u.Password
|
||||
}
|
||||
|
||||
// Set the value of Password
|
||||
func (u *User) SetPassword(value []byte) *User {
|
||||
u.changed = append(u.changed, "Password")
|
||||
u.Password = value
|
||||
return u
|
||||
}
|
||||
|
||||
// Get the value of SuspendedAt
|
||||
func (u *User) GetSuspendedAt() *time.Time {
|
||||
return u.SuspendedAt
|
||||
}
|
||||
|
||||
// Set the value of SuspendedAt
|
||||
func (u *User) SetSuspendedAt(value *time.Time) *User {
|
||||
u.changed = append(u.changed, "SuspendedAt")
|
||||
u.SuspendedAt = value
|
||||
return u
|
||||
}
|
||||
|
||||
// Get the value of DeletedAt
|
||||
func (u *User) GetDeletedAt() *time.Time {
|
||||
return u.DeletedAt
|
||||
}
|
||||
|
||||
// Set the value of DeletedAt
|
||||
func (u *User) SetDeletedAt(value *time.Time) *User {
|
||||
u.changed = append(u.changed, "DeletedAt")
|
||||
u.DeletedAt = value
|
||||
return u
|
||||
}
|
||||
|
||||
// Changes returns the names of changed fields
|
||||
func (u *User) Changes() []string {
|
||||
return u.changed
|
||||
}
|
||||
|
||||
+13
-3
@@ -16,7 +16,7 @@ package types
|
||||
*/
|
||||
|
||||
type (
|
||||
// Websocket
|
||||
// Websocket -
|
||||
Websocket struct {
|
||||
UserID uint64 `db:"user_id"`
|
||||
User User `db:"user"`
|
||||
@@ -25,16 +25,17 @@ type (
|
||||
}
|
||||
)
|
||||
|
||||
/* Constructors */
|
||||
// New constructs a new instance of Websocket
|
||||
func (Websocket) New() *Websocket {
|
||||
return &Websocket{}
|
||||
}
|
||||
|
||||
/* Getters/setters */
|
||||
// Get the value of UserID
|
||||
func (w *Websocket) GetUserID() uint64 {
|
||||
return w.UserID
|
||||
}
|
||||
|
||||
// Set the value of UserID
|
||||
func (w *Websocket) SetUserID(value uint64) *Websocket {
|
||||
if w.UserID != value {
|
||||
w.changed = append(w.changed, "UserID")
|
||||
@@ -42,11 +43,20 @@ func (w *Websocket) SetUserID(value uint64) *Websocket {
|
||||
}
|
||||
return w
|
||||
}
|
||||
|
||||
// Get the value of User
|
||||
func (w *Websocket) GetUser() User {
|
||||
return w.User
|
||||
}
|
||||
|
||||
// Set the value of User
|
||||
func (w *Websocket) SetUser(value User) *Websocket {
|
||||
w.changed = append(w.changed, "User")
|
||||
w.User = value
|
||||
return w
|
||||
}
|
||||
|
||||
// Changes returns the names of changed fields
|
||||
func (w *Websocket) Changes() []string {
|
||||
return w.changed
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user