Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( //ErrUserNotFound represent user is not found when searching in repository ErrUserNotFound = errors.New("User not found") //ErrDuplicateKey represent insert duplicated user ErrDuplicateKey = errors.New("Duplicate key in user") )
View Source
var ( //ErrKeyNotFound represent key is not found when searching in KeyValueService ErrKeyNotFound = errors.New("Key not found") )
View Source
var ( //ErrSessionNotFound represent session not found ErrSessionNotFound = errors.New("Session not found") )
Functions ¶
This section is empty.
Types ¶
type Event ¶
type Event struct { ID int UserID int Event string UserAgent string IP string ClientID int ClientName string Timestamp time.Time CreatedAt time.Time }
Event is domain entity
type EventFilterOptions ¶
type EventPagingOptions ¶
EventPagingOptions is a struct used as pagination option to get events
type EventRepository ¶
type EventRepository interface { FindAll(filter EventFilterOptions, paging EventPagingOptions) (Events, int, error) Insert(event Event) error DeleteAllByUserID(userID int) error }
EventRepository provide an interface to get user events
type KeyValueService ¶
type KeyValueService interface { Set(key string, value []byte) error SetEx(key string, value []byte, expirationInSeconds time.Duration) error Get(key string) ([]byte, error) Delete(key string) error }
KeyValueService provide an interface to get key
type ObjectMetaData ¶
type ObjectMetaData struct { ContentType string ContentEncoding string Size int64 CacheControl string Path string }
ObjectMetaData is data about object
type ObjectStorageService ¶
type ObjectStorageService interface { // should write with options Write(reader io.Reader, metadata ObjectMetaData) (string, error) Fetch(path string) ([]byte, ObjectMetaData, error) }
ObjectStorageService provide an interface to get objects
type Session ¶
type Session struct { ID string Token string IP string ClientID int ClientName string Expiration time.Duration CreatedAt time.Time UpdatedAt time.Time }
Session is domain entity
type SessionRepository ¶
type SessionRepository interface { Create(userID int, session Session) error FindAllByUserID(userID int) (Sessions, error) DeleteExpiredSessions(userID int) error DeleteBySessionID(userID int, sessionID string) error DeleteOtherSessions(userID int, sessionID string) (deletedSessionIDs []string, err error) }
SessionRepository provide an interface to get user sessions
type User ¶
type User struct { ID int Email string Fullname string Phone string Location string Bio string WebURL string PictureURL string Password string TFAEnabled bool Verified bool BackupCodes []string TFAEnabledAt time.Time CreatedAt time.Time UpdatedAt time.Time }
User is domain entity
type UserRepository ¶
type UserRepository interface { Find(id int) (User, error) FindByEmail(email string) (User, error) Insert(user *User) error Update(user User) error // problematic func here StoreBackupCodes(user User) error Delete(id int) error }
UserRepository provide an interface to get user entities
Source Files ¶
Click to show internal directories.
Click to hide internal directories.