queries

package
v0.0.0-...-784c0f6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 23, 2024 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetSettingByGroup

func GetSettingByGroup[T any](ctx context.Context) (*T, error)

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.

func Init

func Init(cfg storage.Database, embed embed.FS) error

Init is ...

Types

type AuditQueries

type AuditQueries struct {
	*sql.DB
}

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) Audit

func (q *AuditQueries) Audit(ctx context.Context, id string) (*models.Audit, error)

Audit is ...

func (*AuditQueries) Audits

func (q *AuditQueries) Audits(ctx context.Context, pagination *webutil.PaginationQuery) (*models.Audits, error)

Audits is ...

type AuthQueries

type AuthQueries struct {
	*sql.DB
}

AuthQueries is ...

func (*AuthQueries) AccessLinkLetter

func (q *AuthQueries) AccessLinkLetter(ctx context.Context, email, token, expires string) (*models.MailMessage, error)

AccessLinkLetter

func (*AuthQueries) CustomerIDByEmail

func (q *AuthQueries) CustomerIDByEmail(ctx context.Context, email string) (string, error)

CustomerIDByEmail is ...

type Base

Base is ...

func DB

func DB() *Base

DB 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

type CustomerQueries struct {
	*sql.DB
}

CustomerQueries is ...

func (*CustomerQueries) AddCustomer

func (q *CustomerQueries) AddCustomer(ctx context.Context, customer *models.Customer) error

AddCustomer is ...

func (*CustomerQueries) Customer

func (q *CustomerQueries) Customer(ctx context.Context, id string) (*models.Customer, error)

Customer 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

func (q *CustomerQueries) UpdateCustomer(ctx context.Context, customer *models.Customer) error

UpdateCustomer is ...

type LicenseQueries

type LicenseQueries struct {
	*sql.DB
}

LicenseQueries is ...

func (*LicenseQueries) AddLicense

func (q *LicenseQueries) AddLicense(ctx context.Context, payment *models.Payment) error

AddLicense is ...

func (*LicenseQueries) License

func (q *LicenseQueries) License(ctx context.Context, id string, customerID string) (*models.License, error)

License is ...

func (*LicenseQueries) Licenses

func (q *LicenseQueries) Licenses(ctx context.Context, pagination *webutil.PaginationQuery, customerID string) (*models.Licenses, error)

Licenses is ...

type ListQueries

type ListQueries struct {
	*sql.DB
}

PatternQueries is ...

func (*ListQueries) ListCountries

func (q *ListQueries) ListCountries(ctx context.Context, name string) ([]models.SettingName, error)

ListCountries is ...

func (*ListQueries) ListCustomers

func (q *ListQueries) ListCustomers(ctx context.Context) (*models.Customers, error)

ListCustomers is ...

func (*ListQueries) ListPatterns

func (q *ListQueries) ListPatterns(ctx context.Context) (*models.Patterns, error)

ListPatterns is ...

type PatternQueries

type PatternQueries struct {
	*sql.DB
}

PatternQueries is ...

func (*PatternQueries) AddPattern

func (q *PatternQueries) AddPattern(ctx context.Context, pattern *models.Pattern) error

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) Pattern

func (q *PatternQueries) Pattern(ctx context.Context, id string) (*models.Pattern, error)

Pattern is ...

func (*PatternQueries) Patterns

func (q *PatternQueries) Patterns(ctx context.Context, pagination *webutil.PaginationQuery) (*models.Patterns, error)

Patterns is ...

func (*PatternQueries) UpdatePattern

func (q *PatternQueries) UpdatePattern(ctx context.Context, pattern *models.Pattern) error

UpdatePattern is ...

type PaymentsQueries

type PaymentsQueries struct {
	*sql.DB
}

PaymentsQueries is ...

func (*PaymentsQueries) AddPayment

func (q *PaymentsQueries) AddPayment(ctx context.Context, payment *models.Payment) error

AddPayment is ...

func (*PaymentsQueries) Payment

func (q *PaymentsQueries) Payment(ctx context.Context, id string) (*models.Payment, error)

Payment is ...

func (*PaymentsQueries) Payments

func (q *PaymentsQueries) Payments(ctx context.Context, pagination *webutil.PaginationQuery) (*models.Payments, error)

Payments is ...

func (*PaymentsQueries) PaymentsNoLicense

func (q *PaymentsQueries) PaymentsNoLicense(ctx context.Context) (*models.Payments, error)

PaymentsNoLicense is ...

func (*PaymentsQueries) UpdatePayment

func (q *PaymentsQueries) UpdatePayment(ctx context.Context, payment *models.Payment) error

UpdatePayment is ...

type SettingQueries

type SettingQueries struct {
	*sql.DB
}

SettingQueries wraps a sql.DB connection allowing for easy querying and interaction with the database related to application settings.

func (*SettingQueries) GetSettingByGroup

func (q *SettingQueries) GetSettingByGroup(ctx context.Context, settings any) (any, error)

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL