Documentation ¶
Index ¶
- func GetSettingByGroup[T any](ctx context.Context) (*T, error)
- func Init(cfg storage.Database, embed embed.FS) error
- type AuditQueries
- func (q *AuditQueries) AddAudit(ctx context.Context, section models.Section, customerID string, ...) error
- func (q *AuditQueries) Audit(ctx context.Context, id string) (*models.Audit, error)
- func (q *AuditQueries) Audits(ctx context.Context, pagination *webutil.PaginationQuery) (*models.Audits, error)
- type AuthQueries
- type Base
- type CustomerQueries
- func (q *CustomerQueries) AddCustomer(ctx context.Context, customer *models.Customer) error
- func (q *CustomerQueries) Customer(ctx context.Context, id string) (*models.Customer, error)
- func (q *CustomerQueries) Customers(ctx context.Context, pagination *webutil.PaginationQuery) (*models.Customers, error)
- func (q *CustomerQueries) DeleteCustomer(ctx context.Context, id string) error
- func (q *CustomerQueries) UpdateCustomer(ctx context.Context, customer *models.Customer) error
- type LicenseQueries
- func (q *LicenseQueries) AddLicense(ctx context.Context, payment *models.Payment) error
- func (q *LicenseQueries) License(ctx context.Context, id string, customerID string) (*models.License, error)
- func (q *LicenseQueries) Licenses(ctx context.Context, pagination *webutil.PaginationQuery, customerID string) (*models.Licenses, error)
- type ListQueries
- type PatternQueries
- func (q *PatternQueries) AddPattern(ctx context.Context, pattern *models.Pattern) error
- func (q *PatternQueries) ClonePattern(ctx context.Context, pattern *models.Pattern) (*models.Pattern, error)
- func (q *PatternQueries) DeletePattern(ctx context.Context, id string) error
- func (q *PatternQueries) Pattern(ctx context.Context, id string) (*models.Pattern, error)
- func (q *PatternQueries) Patterns(ctx context.Context, pagination *webutil.PaginationQuery) (*models.Patterns, error)
- func (q *PatternQueries) UpdatePattern(ctx context.Context, pattern *models.Pattern) error
- type PaymentsQueries
- func (q *PaymentsQueries) AddPayment(ctx context.Context, payment *models.Payment) error
- func (q *PaymentsQueries) Payment(ctx context.Context, id string) (*models.Payment, error)
- func (q *PaymentsQueries) Payments(ctx context.Context, pagination *webutil.PaginationQuery) (*models.Payments, error)
- func (q *PaymentsQueries) PaymentsNoLicense(ctx context.Context) (*models.Payments, error)
- func (q *PaymentsQueries) UpdatePayment(ctx context.Context, payment *models.Payment) error
- type SettingQueries
- func (q *SettingQueries) GetSettingByGroup(ctx context.Context, settings any) (any, error)
- func (q *SettingQueries) GetSettingByKey(ctx context.Context, key ...string) (map[string]models.SettingName, error)
- func (q *SettingQueries) GroupFieldMap(settings any) models.Metadata
- func (q *SettingQueries) UpdateSettingByGroup(ctx context.Context, settings any) error
- func (q *SettingQueries) UpdateSettingByKey(ctx context.Context, setting *models.SettingName) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetSettingByGroup ¶
GetSettingByGroup is a generic function that retrieves a setting from the database. It takes a context and a pointer to the Base struct which holds the database methods. The function returns a pointer to the requested setting of type T or an error if any occurs.
Types ¶
type AuditQueries ¶
AuditQueries is ...
func (*AuditQueries) AddAudit ¶
func (q *AuditQueries) AddAudit(ctx context.Context, section models.Section, customerID string, action models.AuditAction, metadata any) error
AddAudit is ...
func (*AuditQueries) Audits ¶
func (q *AuditQueries) Audits(ctx context.Context, pagination *webutil.PaginationQuery) (*models.Audits, error)
Audits is ...
type AuthQueries ¶
AuthQueries is ...
func (*AuthQueries) AccessLinkLetter ¶
func (q *AuthQueries) AccessLinkLetter(ctx context.Context, email, token, expires string) (*models.MailMessage, error)
AccessLinkLetter
func (*AuthQueries) CustomerIDByEmail ¶
CustomerIDByEmail is ...
type Base ¶
type Base struct { AuditQueries SettingQueries AuthQueries LicenseQueries PatternQueries CustomerQueries PaymentsQueries ListQueries }
Base is ...
func (*Base) SQLPagination ¶
func (db *Base) SQLPagination(params webutil.PaginationQuery) string
SQLPagination is ... example query's for sortBy - id:DESC or id:ASC
type CustomerQueries ¶
CustomerQueries is ...
func (*CustomerQueries) AddCustomer ¶
AddCustomer is ...
func (*CustomerQueries) Customers ¶
func (q *CustomerQueries) Customers(ctx context.Context, pagination *webutil.PaginationQuery) (*models.Customers, error)
Customers is ...
func (*CustomerQueries) DeleteCustomer ¶
func (q *CustomerQueries) DeleteCustomer(ctx context.Context, id string) error
DeleteCustomer is ...
func (*CustomerQueries) UpdateCustomer ¶
UpdateCustomer is ...
type LicenseQueries ¶
LicenseQueries is ...
func (*LicenseQueries) AddLicense ¶
AddLicense is ...
type ListQueries ¶
PatternQueries is ...
func (*ListQueries) ListCountries ¶
func (q *ListQueries) ListCountries(ctx context.Context, name string) ([]models.SettingName, error)
ListCountries is ...
func (*ListQueries) ListCustomers ¶
ListCustomers is ...
func (*ListQueries) ListPatterns ¶
ListPatterns is ...
type PatternQueries ¶
PatternQueries is ...
func (*PatternQueries) AddPattern ¶
AddPattern is ...
func (*PatternQueries) ClonePattern ¶
func (q *PatternQueries) ClonePattern(ctx context.Context, pattern *models.Pattern) (*models.Pattern, error)
ClonePattern is ...
func (*PatternQueries) DeletePattern ¶
func (q *PatternQueries) DeletePattern(ctx context.Context, id string) error
DeletePattern is ...
func (*PatternQueries) Patterns ¶
func (q *PatternQueries) Patterns(ctx context.Context, pagination *webutil.PaginationQuery) (*models.Patterns, error)
Patterns is ...
func (*PatternQueries) UpdatePattern ¶
UpdatePattern is ...
type PaymentsQueries ¶
PaymentsQueries is ...
func (*PaymentsQueries) AddPayment ¶
AddPayment is ...
func (*PaymentsQueries) Payments ¶
func (q *PaymentsQueries) Payments(ctx context.Context, pagination *webutil.PaginationQuery) (*models.Payments, error)
Payments is ...
func (*PaymentsQueries) PaymentsNoLicense ¶
PaymentsNoLicense is ...
func (*PaymentsQueries) UpdatePayment ¶
UpdatePayment is ...
type SettingQueries ¶
SettingQueries wraps a sql.DB connection allowing for easy querying and interaction with the database related to application settings.
func (*SettingQueries) GetSettingByGroup ¶
GetSettingByGroup retrieves settings based on the provided `settings` struct, populating it with values from the database.
func (*SettingQueries) GetSettingByKey ¶
func (q *SettingQueries) GetSettingByKey(ctx context.Context, key ...string) (map[string]models.SettingName, error)
GetSettingByKey retrieves a setting by its key from the database. It accepts a context for cancellation and a string representing the key of the setting. Returns a pointer to a SettingName model if found, or an error if not found or any other issue occurs.
func (*SettingQueries) GroupFieldMap ¶
func (q *SettingQueries) GroupFieldMap(settings any) models.Metadata
GroupFieldMap generates a map of fields based on the type of settings.
func (*SettingQueries) UpdateSettingByGroup ¶
func (q *SettingQueries) UpdateSettingByGroup(ctx context.Context, settings any) error
UpdateSettingByGroup updates the settings in the database using a transaction. It takes a context and a settings object of any type as arguments.
func (*SettingQueries) UpdateSettingByKey ¶
func (q *SettingQueries) UpdateSettingByKey(ctx context.Context, setting *models.SettingName) error
UpdateSettingByKey updates the value of a setting in the database based on the provided key.