Documentation
¶
Index ¶
- Constants
- func UserNoImageUrl() string
- type NewStoreOptions
- type Store
- func (store *Store) AutoMigrate() error
- func (st *Store) EnableDebug(debug bool)
- func (store *Store) UserCount(options UserQueryOptions) (int64, error)
- func (store *Store) UserCreate(user UserInterface) error
- func (store *Store) UserDelete(user UserInterface) error
- func (store *Store) UserDeleteByID(id string) error
- func (store *Store) UserFindByEmail(email string) (UserInterface, error)
- func (store *Store) UserFindByEmailOrCreate(email string, createStatus string) (UserInterface, error)
- func (store *Store) UserFindByID(id string) (UserInterface, error)
- func (store *Store) UserList(options UserQueryOptions) ([]UserInterface, error)
- func (store *Store) UserSoftDelete(user UserInterface) error
- func (store *Store) UserSoftDeleteByID(id string) error
- func (store *Store) UserUpdate(user UserInterface) error
- type StoreInterface
- type TimezoneQueryOptions
- type User
- func (o *User) BusinessName() string
- func (o *User) Country() string
- func (o *User) CreatedAt() string
- func (o *User) CreatedAtCarbon() carbon.Carbon
- func (o *User) DeletedAt() string
- func (o *User) Email() string
- func (o *User) FirstName() string
- func (o *User) ID() string
- func (o *User) IsActive() bool
- func (o *User) IsAdministrator() bool
- func (o *User) IsDeleted() bool
- func (o *User) IsInactive() bool
- func (o *User) IsManager() bool
- func (o *User) IsRegistrationCompleted() bool
- func (o *User) IsSuperuser() bool
- func (o *User) IsUnverified() bool
- func (o *User) LastName() string
- func (o *User) Memo() string
- func (o *User) Meta(name string) string
- func (o *User) Metas() (map[string]string, error)
- func (o *User) MiddleNames() string
- func (o *User) Password() string
- func (o *User) PasswordCompare(password string) bool
- func (o *User) Phone() string
- func (o *User) ProfileImageOrDefaultUrl() string
- func (o *User) ProfileImageUrl() string
- func (o *User) Role() string
- func (o *User) SetBusinessName(businessName string) UserInterface
- func (o *User) SetCountry(country string) UserInterface
- func (o *User) SetCreatedAt(createdAt string) UserInterface
- func (o *User) SetDeletedAt(deletedAt string) UserInterface
- func (o *User) SetEmail(email string) UserInterface
- func (o *User) SetFirstName(firstName string) UserInterface
- func (o *User) SetID(id string) UserInterface
- func (o *User) SetLastName(lastName string) UserInterface
- func (o *User) SetMemo(memo string) UserInterface
- func (o *User) SetMeta(name string, value string) error
- func (o *User) SetMetas(metas map[string]string) error
- func (o *User) SetMiddleNames(middleNames string) UserInterface
- func (o *User) SetPassword(password string) UserInterface
- func (o *User) SetPasswordAndHash(password string) error
- func (o *User) SetPhone(phone string) UserInterface
- func (o *User) SetProfileImageUrl(imageUrl string) UserInterface
- func (o *User) SetRole(role string) UserInterface
- func (o *User) SetStatus(status string) UserInterface
- func (o *User) SetTimezone(timezone string) UserInterface
- func (o *User) SetUpdatedAt(updatedAt string) UserInterface
- func (o *User) Status() string
- func (o *User) Timezone() string
- func (o *User) UpdatedAt() string
- func (o *User) UpdatedAtCarbon() carbon.Carbon
- func (o *User) UpsertMetas(metas map[string]string) error
- type UserInterface
- type UserQueryOptions
Constants ¶
const COLUMN_CREATED_AT = "created_at"
const COLUMN_DELETED_AT = "deleted_at"
const COLUMN_EMAIL = "email"
const COLUMN_FIRST_NAME = "first_name"
const COLUMN_ID = "id"
const COLUMN_LAST_NAME = "last_name"
const COLUMN_ROLE = "role"
const COLUMN_STATUS = "status"
const COLUMN_UPDATED_AT = "updated_at"
const USER_ROLE_ADMINISTRATOR = "administrator"
const USER_ROLE_MANAGER = "manager"
const USER_ROLE_SUPERUSER = "superuser"
const USER_ROLE_USER = "user"
const USER_STATUS_ACTIVE = "active"
const USER_STATUS_DELETED = "deleted"
const USER_STATUS_INACTIVE = "inactive"
const USER_STATUS_UNVERIFIED = "unverified"
Variables ¶
This section is empty.
Functions ¶
func UserNoImageUrl ¶
func UserNoImageUrl() string
Types ¶
type NewStoreOptions ¶
type NewStoreOptions struct {
UserTableName string
DB *sql.DB
DbDriverName string
AutomigrateEnabled bool
DebugEnabled bool
}
NewStoreOptions define the options for creating a new block store
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
func NewStore ¶
func NewStore(opts NewStoreOptions) (*Store, error)
NewStore creates a new block store
func (*Store) EnableDebug ¶
EnableDebug - enables the debug option
func (*Store) UserCreate ¶
func (store *Store) UserCreate(user UserInterface) error
func (*Store) UserDelete ¶
func (store *Store) UserDelete(user UserInterface) error
func (*Store) UserDeleteByID ¶
func (*Store) UserFindByEmail ¶
func (store *Store) UserFindByEmail(email string) (UserInterface, error)
func (*Store) UserFindByEmailOrCreate ¶
func (store *Store) UserFindByEmailOrCreate(email string, createStatus string) (UserInterface, error)
UserFindByEmailOrCreate - finds by email or creates a user (with active status)
func (*Store) UserFindByID ¶
func (store *Store) UserFindByID(id string) (UserInterface, error)
func (*Store) UserList ¶
func (store *Store) UserList(options UserQueryOptions) ([]UserInterface, error)
func (*Store) UserSoftDelete ¶
func (store *Store) UserSoftDelete(user UserInterface) error
func (*Store) UserSoftDeleteByID ¶
func (*Store) UserUpdate ¶
func (store *Store) UserUpdate(user UserInterface) error
type StoreInterface ¶
type StoreInterface interface {
AutoMigrate() error
EnableDebug(debug bool)
UserCreate(user UserInterface) error
UserDelete(user UserInterface) error
UserDeleteByID(id string) error
UserFindByID(userID string) (UserInterface, error)
UserList(options UserQueryOptions) ([]UserInterface, error)
UserSoftDelete(user UserInterface) error
UserSoftDeleteByID(id string) error
UserUpdate(user UserInterface) error
}
type TimezoneQueryOptions ¶
type User ¶
type User struct {
dataobject.DataObject
}
func (*User) BusinessName ¶
func (*User) CreatedAtCarbon ¶
func (*User) IsAdministrator ¶
func (*User) IsInactive ¶
func (*User) IsRegistrationCompleted ¶
IsRegistrationCompleted checks if the user registration is incomplete.
Registration is considered incomplete if the user's first name or last name is empty.
Parameters: - authUser: a pointer to a userstore.User object representing the authenticated user.
Returns: - bool: true if the user registration is incomplete, false otherwise.
func (*User) IsSuperuser ¶
func (*User) IsUnverified ¶
func (*User) MiddleNames ¶
func (*User) PasswordCompare ¶
func (*User) ProfileImageOrDefaultUrl ¶
func (*User) ProfileImageUrl ¶
func (*User) SetBusinessName ¶
func (o *User) SetBusinessName(businessName string) UserInterface
func (*User) SetCountry ¶
func (o *User) SetCountry(country string) UserInterface
func (*User) SetCreatedAt ¶
func (o *User) SetCreatedAt(createdAt string) UserInterface
func (*User) SetDeletedAt ¶
func (o *User) SetDeletedAt(deletedAt string) UserInterface
func (*User) SetEmail ¶
func (o *User) SetEmail(email string) UserInterface
func (*User) SetFirstName ¶
func (o *User) SetFirstName(firstName string) UserInterface
func (*User) SetID ¶
func (o *User) SetID(id string) UserInterface
func (*User) SetLastName ¶
func (o *User) SetLastName(lastName string) UserInterface
func (*User) SetMemo ¶
func (o *User) SetMemo(memo string) UserInterface
func (*User) SetMetas ¶
SetMetas stores metas as json string Warning: it overwrites any existing metas
func (*User) SetMiddleNames ¶
func (o *User) SetMiddleNames(middleNames string) UserInterface
func (*User) SetPassword ¶
func (o *User) SetPassword(password string) UserInterface
SetPassword sets the password as provided, if you want it hashed use SetPasswordAndHash() method
func (*User) SetPasswordAndHash ¶
SetPasswordAndHash hashes the password before saving
func (*User) SetPhone ¶
func (o *User) SetPhone(phone string) UserInterface
func (*User) SetProfileImageUrl ¶
func (o *User) SetProfileImageUrl(imageUrl string) UserInterface
func (*User) SetRole ¶
func (o *User) SetRole(role string) UserInterface
func (*User) SetStatus ¶
func (o *User) SetStatus(status string) UserInterface
func (*User) SetTimezone ¶
func (o *User) SetTimezone(timezone string) UserInterface
func (*User) SetUpdatedAt ¶
func (o *User) SetUpdatedAt(updatedAt string) UserInterface
func (*User) UpdatedAtCarbon ¶
type UserInterface ¶
type UserInterface interface {
Data() map[string]string
DataChanged() map[string]string
MarkAsNotDirty()
IsActive() bool
IsDeleted() bool
IsInactive() bool
IsUnverified() bool
IsAdministrator() bool
IsManager() bool
IsSuperuser() bool
IsRegistrationCompleted() bool
BusinessName() string
SetBusinessName(businessName string) UserInterface
Country() string
SetCountry(country string) UserInterface
CreatedAt() string
CreatedAtCarbon() carbon.Carbon
SetCreatedAt(createdAt string) UserInterface
DeletedAt() string
SetDeletedAt(deletedAt string) UserInterface
Email() string
SetEmail(email string) UserInterface
ID() string
SetID(id string) UserInterface
FirstName() string
SetFirstName(firstName string) UserInterface
LastName() string
SetLastName(lastName string) UserInterface
Memo() string
SetMemo(memo string) UserInterface
Meta(name string) string
SetMeta(name string, value string) error
Metas() (map[string]string, error)
SetMetas(metas map[string]string) error
MiddleNames() string
SetMiddleNames(middleNames string) UserInterface
Password() string
SetPassword(password string) UserInterface
Phone() string
SetPhone(phone string) UserInterface
ProfileImageUrl() string
SetProfileImageUrl(profileImageUrl string) UserInterface
Role() string
SetRole(role string) UserInterface
Timezone() string
SetTimezone(timezone string) UserInterface
Status() string
SetStatus(status string) UserInterface
PasswordCompare(password string) bool
UpdatedAt() string
UpdatedAtCarbon() carbon.Carbon
SetUpdatedAt(updatedAt string) UserInterface
}
func NewUser ¶
func NewUser() UserInterface
func NewUserFromExistingData ¶
func NewUserFromExistingData(data map[string]string) UserInterface