Documentation
¶
Index ¶
- func InTransaction(ctx context.Context, db *sql.DB, f func(tx *sql.Tx) error) error
- type Chat
- func (chat *Chat) AddExclude(userIDs map[string]struct{})
- func (chat *Chat) DelExclude(userIDs map[string]struct{})
- func (chat *Chat) Equal(c *Chat) bool
- func (chat *Chat) ExcludeToMap() error
- func (chat *Chat) ExcludeToString() error
- func (chat *Chat) Update(ctx context.Context, db *sql.DB) error
- func (chat *Chat) Upsert(ctx context.Context, db *sql.DB) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Chat ¶
type Chat struct { ID string `db:"id"` Active bool `db:"active"` Exclude string `db:"exclude"` URL string `db:"url"` Created time.Time `db:"created_at"` Updated time.Time `db:"updated_at"` ExcludeUsers map[string]struct{} Saved bool }
Chat is a struct for chat's info.
func GetOrCreate ¶
GetOrCreate loads a chat by its ID or creates a new one but without saving it.
func (*Chat) AddExclude ¶
AddExclude adds user to an exclude set.
func (*Chat) DelExclude ¶
DelExclude removes user from an exclude set.
func (*Chat) ExcludeToMap ¶
ExcludeToMap loads exclude users set from a string.
func (*Chat) ExcludeToString ¶
ExcludeToString returns a string of exclude users set.
Click to show internal directories.
Click to hide internal directories.