23 lines
367 B
Go
23 lines
367 B
Go
package isolation
|
|
|
|
import (
|
|
"errors"
|
|
|
|
"github.com/google/uuid"
|
|
)
|
|
|
|
var ErrNotOwner = errors.New("isolation: lock is not held by this owner")
|
|
|
|
type Key struct {
|
|
UpdateID uuid.UUID // владелец
|
|
UserID int64
|
|
ChatID int64
|
|
}
|
|
|
|
type Scope struct {
|
|
UserID int64
|
|
ChatID int64
|
|
}
|
|
|
|
func (k Key) Scope() Scope { return Scope{UserID: k.UserID, ChatID: k.ChatID} }
|