Documentation
¶
Index ¶
- Constants
- func GenerateShortID() string
- func IsShortID(id string) bool
- func NormalizeID(id string) string
- func RoleNoImageUrl() string
- func ShortenID(id string) string
- func UnshortenID(shortID string) (string, error)
- func UserNoImageUrl() string
- type NewStoreOptions
- type RoleInterface
- type RoleQueryInterface
- type StoreInterface
- type UserInterface
- type UserQueryInterface
Constants ¶
View Source
const COLUMN_BUSINESS_NAME = "business_name"
View Source
const COLUMN_COUNTRY = "country"
View Source
const COLUMN_CREATED_AT = "created_at"
View Source
const COLUMN_EMAIL = "email"
View Source
const COLUMN_FIRST_NAME = "first_name"
View Source
const COLUMN_HANDLE = "handle"
View Source
const COLUMN_ID = "id"
View Source
const COLUMN_LAST_NAME = "last_name"
View Source
const COLUMN_MEMO = "memo"
View Source
const COLUMN_METAS = "metas"
View Source
const COLUMN_MIDDLE_NAMES = "middle_names"
View Source
const COLUMN_NAME = "name"
View Source
const COLUMN_PASSWORD = "password"
View Source
const COLUMN_PHONE = "phone"
View Source
const COLUMN_PROFILE_IMAGE_URL = "profile_image_url"
View Source
const COLUMN_ROLE = "role"
View Source
const COLUMN_SOFT_DELETED_AT = "soft_deleted_at"
View Source
const COLUMN_STATUS = "status"
View Source
const COLUMN_TIMEZONE = "timezone"
View Source
const COLUMN_UPDATED_AT = "updated_at"
View Source
const ERROR_EMPTY_ARRAY = "array cannot be empty"
View Source
const ERROR_EMPTY_STRING = "string cannot be empty"
View Source
const ERROR_NEGATIVE_NUMBER = "number cannot be negative"
View Source
const MAX_DATETIME = "9999-12-31 23:59:59"
MAX_DATETIME is a far-future datetime used as the default soft-delete sentinel.
View Source
const ROLE_STATUS_ACTIVE = "active"
View Source
const ROLE_STATUS_DELETED = "deleted"
View Source
const ROLE_STATUS_INACTIVE = "inactive"
View Source
const SORT_ORDER_ASC = "asc"
View Source
const SORT_ORDER_DESC = "desc"
View Source
const USER_ROLE_ADMINISTRATOR = "administrator"
View Source
const USER_ROLE_MANAGER = "manager"
View Source
const USER_ROLE_SUPERUSER = "superuser"
View Source
const USER_ROLE_USER = "user"
View Source
const USER_STATUS_ACTIVE = "active"
View Source
const USER_STATUS_DELETED = "deleted"
View Source
const USER_STATUS_INACTIVE = "inactive"
View Source
const USER_STATUS_UNVERIFIED = "unverified"
Variables ¶
This section is empty.
Functions ¶
func GenerateShortID ¶ added in v1.7.0
func GenerateShortID() string
GenerateShortID generates a new shortened ID using neat's UID generator.
func IsShortID ¶ added in v1.7.0
IsShortID checks if an ID appears to be shortened (9-21 chars, alphanumeric)
func NormalizeID ¶ added in v1.7.0
NormalizeID normalizes an ID for lookup (lowercase)
func RoleNoImageUrl ¶
func RoleNoImageUrl() string
func UnshortenID ¶ added in v1.7.0
UnshortenID attempts to unshorten a Crockford Base32 ID
func UserNoImageUrl ¶
func UserNoImageUrl() string
Types ¶
type NewStoreOptions ¶
type NewStoreOptions struct {
UserTableName string
DB *sql.DB
AutomigrateEnabled bool
DebugEnabled bool
}
NewStoreOptions define the options for creating a new user store
type RoleInterface ¶
type RoleInterface interface {
Data() map[string]string
DataChanged() map[string]string
MarkAsNotDirty()
ToMap() map[string]any
GetCreatedAt() string
GetCreatedAtCarbon() *carbon.Carbon
SetCreatedAt(createdAt string) RoleInterface
GetHandle() string
SetHandle(handle string) RoleInterface
GetID() string
SetID(id string) RoleInterface
GetName() string
SetName(name string) RoleInterface
GetMemo() string
SetMemo(memo string) RoleInterface
GetMeta(name string) string
SetMeta(name string, value string) error
GetMetas() (map[string]string, error)
SetMetas(metas map[string]string) error
GetStatus() string
SetStatus(status string) RoleInterface
GetSoftDeletedAt() string
GetSoftDeletedAtCarbon() *carbon.Carbon
SetSoftDeletedAt(softDeletedAt string) RoleInterface
GetUpdatedAt() string
GetUpdatedAtCarbon() *carbon.Carbon
SetUpdatedAt(updatedAt string) RoleInterface
}
func NewRole ¶
func NewRole() RoleInterface
func NewRoleFromExistingData ¶
func NewRoleFromExistingData(data map[string]string) RoleInterface
type RoleQueryInterface ¶
type RoleQueryInterface interface {
Validate() error
Columns() []string
SetColumns(columns []string) RoleQueryInterface
HasCountOnly() bool
IsCountOnly() bool
SetCountOnly(countOnly bool) RoleQueryInterface
HasHandle() bool
Handle() string
SetHandle(handle string) RoleQueryInterface
HasID() bool
GetID() string
SetID(id string) RoleQueryInterface
HasLimit() bool
Limit() int
SetLimit(limit int) RoleQueryInterface
HasOffset() bool
Offset() int
SetOffset(offset int) RoleQueryInterface
HasOrderBy() bool
OrderBy() string
SetOrderBy(orderBy string) RoleQueryInterface
HasSortDirection() bool
SortDirection() string
SetSortDirection(sortDirection string) RoleQueryInterface
HasSoftDeletedIncluded() bool
SoftDeletedIncluded() bool
SetSoftDeletedIncluded(softDeletedIncluded bool) RoleQueryInterface
HasStatus() bool
Status() string
SetStatus(status string) RoleQueryInterface
HasTitleLike() bool
TitleLike() string
SetTitleLike(titleLike string) RoleQueryInterface
// contains filtered or unexported methods
}
func NewRoleQuery ¶
func NewRoleQuery() RoleQueryInterface
type StoreInterface ¶
type StoreInterface interface {
// GetUserTableName returns the user table name
GetUserTableName() string
// SetUserTableName sets the user table name
SetUserTableName(tableName string)
// MigrateDown drops the user table
MigrateDown(ctx context.Context, tx ...*sql.Tx) error
// MigrateUp creates the user table
MigrateUp(ctx context.Context, tx ...*sql.Tx) error
EnableDebug(debug bool)
GetDB() *sql.DB
UserCreate(ctx context.Context, user UserInterface) error
UserCount(ctx context.Context, options UserQueryInterface) (int64, error)
UserDelete(ctx context.Context, user UserInterface) error
UserDeleteByID(ctx context.Context, id string) error
UserFindByEmail(ctx context.Context, email string) (UserInterface, error)
UserFindByEmailOrCreate(ctx context.Context, email, createStatus string) (UserInterface, error)
UserFindByID(ctx context.Context, userID string) (UserInterface, error)
UserList(ctx context.Context, query UserQueryInterface) ([]UserInterface, error)
UserSoftDelete(ctx context.Context, user UserInterface) error
UserSoftDeleteByID(ctx context.Context, id string) error
UserUpdate(ctx context.Context, user UserInterface) error
}
func NewStore ¶
func NewStore(opts NewStoreOptions) (StoreInterface, error)
NewStore creates a new user store
type UserInterface ¶
type UserInterface interface {
Data() map[string]string
DataChanged() map[string]string
MarkAsNotDirty()
Get(columnName string) string
Set(columnName string, value string)
ToMap() map[string]any
IsActive() bool
IsInactive() bool
IsSoftDeleted() bool
IsUnverified() bool
IsAdministrator() bool
IsManager() bool
IsSuperuser() bool
IsRegistrationCompleted() bool
GetBusinessName() string
SetBusinessName(businessName string) UserInterface
GetCountry() string
SetCountry(country string) UserInterface
GetCreatedAt() string
GetCreatedAtCarbon() *carbon.Carbon
SetCreatedAt(createdAt string) UserInterface
GetEmail() string
SetEmail(email string) UserInterface
GetID() string
SetID(id string) UserInterface
GetFirstName() string
SetFirstName(firstName string) UserInterface
GetLastName() string
SetLastName(lastName string) UserInterface
GetMemo() string
SetMemo(memo string) UserInterface
GetMeta(name string) string
SetMeta(name string, value string) error
GetMetas() (map[string]string, error)
SetMetas(metas map[string]string) error
UpsertMetas(metas map[string]string) error
GetMiddleNames() string
SetMiddleNames(middleNames string) UserInterface
GetPassword() string
PasswordCompare(password string) bool
SetPassword(password string) UserInterface
SetPasswordAndHash(password string) error
GetPhone() string
SetPhone(phone string) UserInterface
GetProfileImageUrl() string
ProfileImageOrDefaultUrl() string
SetProfileImageUrl(profileImageUrl string) UserInterface
GetRole() string
SetRole(role string) UserInterface
GetSoftDeletedAt() string
GetSoftDeletedAtCarbon() *carbon.Carbon
SetSoftDeletedAt(deletedAt string) UserInterface
GetTimezone() string
SetTimezone(timezone string) UserInterface
GetStatus() string
SetStatus(status string) UserInterface
GetUpdatedAt() string
GetUpdatedAtCarbon() *carbon.Carbon
SetUpdatedAt(updatedAt string) UserInterface
}
func NewUser ¶
func NewUser() UserInterface
func NewUserFromExistingData ¶
func NewUserFromExistingData(data map[string]string) UserInterface
type UserQueryInterface ¶
type UserQueryInterface interface {
Validate() error
Columns() []string
SetColumns(columns []string) UserQueryInterface
HasCountOnly() bool
IsCountOnly() bool
SetCountOnly(countOnly bool) UserQueryInterface
HasCreatedAtGte() bool
CreatedAtGte() string
SetCreatedAtGte(createdAtGte string) UserQueryInterface
HasCreatedAtLte() bool
CreatedAtLte() string
SetCreatedAtLte(createdAtLte string) UserQueryInterface
HasEmail() bool
Email() string
SetEmail(email string) UserQueryInterface
HasEmailLike() bool
EmailLike() string
SetEmailLike(emailLike string) UserQueryInterface
HasFirstName() bool
FirstName() string
SetFirstName(firstName string) UserQueryInterface
HasFirstNameLike() bool
FirstNameLike() string
SetFirstNameLike(firstNameLike string) UserQueryInterface
HasLastName() bool
LastName() string
SetLastName(lastName string) UserQueryInterface
HasLastNameLike() bool
LastNameLike() string
SetLastNameLike(lastNameLike string) UserQueryInterface
HasID() bool
GetID() string
SetID(id string) UserQueryInterface
HasIDIn() bool
IDIn() []string
SetIDIn(idIn []string) UserQueryInterface
HasMetaLike() bool
MetaLike() string
SetMetaLike(metaLike string) UserQueryInterface
HasLimit() bool
Limit() int
SetLimit(limit int) UserQueryInterface
HasOffset() bool
Offset() int
SetOffset(offset int) UserQueryInterface
HasOrderBy() bool
OrderBy() string
SetOrderBy(orderBy string) UserQueryInterface
HasSortDirection() bool
SortDirection() string
SetSortDirection(sortDirection string) UserQueryInterface
HasSoftDeletedIncluded() bool
SoftDeletedIncluded() bool
SetSoftDeletedIncluded(softDeletedIncluded bool) UserQueryInterface
HasStatus() bool
Status() string
SetStatus(status string) UserQueryInterface
HasStatusIn() bool
StatusIn() []string
SetStatusIn(statusIn []string) UserQueryInterface
// contains filtered or unexported methods
}
func NewUserQuery ¶
func NewUserQuery() UserQueryInterface
Source Files
¶
Click to show internal directories.
Click to hide internal directories.