Documentation
¶
Index ¶
- type Shared
- func (s *Shared) AddTags(ctx context.Context, tx pgx.Tx, table, keyName string, keyVal any, ...) error
- func (s *Shared) CredDel(ctx context.Context, tx pgx.Tx, uid types.Uid, method, value string) error
- func (s *Shared) DecodeUidString(str string) int64
- func (s *Shared) DeviceDelete(ctx context.Context, tx pgx.Tx, uid types.Uid, deviceID string) error
- func (s *Shared) DeviceHasher(devID string) string
- func (s *Shared) ExpandQuery(query string, args ...any) (string, []any)
- func (s *Shared) ExtractTags(update map[string]any) []string
- func (s *Shared) IsDupe(err error) bool
- func (s *Shared) MessageDeleteList(ctx context.Context, tx pgx.Tx, topic string, toDel *types.DelMessage) error
- func (s *Shared) SubDelForUser(ctx context.Context, tx pgx.Tx, uid types.Uid, hard bool) error
- func (s *Shared) UpdateByMap(update map[string]any) (cols []string, args []any)
- type SharedArgs
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Shared ¶
type Shared struct {
// contains filtered or unexported fields
}
func NewShared ¶
func NewShared(sa SharedArgs) *Shared
func (*Shared) CredDel ¶
CredDel deletes given validation method or all methods of the given user.
1. If user is being deleted, hard-delete all records (method == "")
2. If one value is being deleted:
2.1 Delete it if it's valiated or if there were no attempts at validation
(otherwise it could be used to circumvent the limit on validation attempts).
2.2 In that case mark it as soft-deleted.
func (*Shared) DecodeUidString ¶
func (*Shared) DeviceDelete ¶
func (*Shared) DeviceHasher ¶
func (*Shared) ExpandQuery ¶
ExpandQuery() converts query strings like: 'where arg = ? AND arg2 = ? ...' to
a query that can be used with pgx library like: 'where arg = $1 AND arg2 = $2 ...'
func (*Shared) ExtractTags ¶
If Tags field is updated, get the tags so tags table cab be updated too.
func (*Shared) IsDupe ¶
Check if Postgres error is an Error Code: 1062. Duplicate entry ... for key ...
func (*Shared) MessageDeleteList ¶
func (*Shared) SubDelForUser ¶
SubDelForUser marks user's subscriptions as deleted.
type SharedArgs ¶
type SharedArgs struct {}