Documentation ¶
Index ¶
- Constants
- Variables
- func BuildOrderBy(on string, allowedFields map[string]string) (orderBy string, err error)
- type Asset
- type Cart
- type CartItem
- type Category
- type CategoryPair
- type CategoryPairs
- type Customer
- type CustomerAddress
- type CustomerPasswordReset
- type ErrorCode
- type InventoryBrand
- type InventoryItem
- type InventoryStock
- type InventorySupplier
- type OthersBought
- type PagingStats
- type PostgresConfig
- type Product
- type Repo
- type RepoError
- type SimilarProducts
- type Store
- type StoreSetting
- type User
Constants ¶
View Source
const ( CustomerLoginError = "incorrect username and password combination" CustomerUpdateError = "can't update customer, missing customer ID" )
View Source
const ( CustomerPasswordResetUpdateError = "can't update customer password reset, missing customer ID" GetCustomerByPasswordResetToken = "could not find valid passsword reset token: %s" )
View Source
const (
CustomerAddressUpdateError = "can't update customer address"
)
Variables ¶
View Source
var (
ErrNotFound = sql.ErrNoRows
)
Functions ¶
Types ¶
type Asset ¶
type Asset interface { Exists() bool Deleted() bool Create(asset *models.Asset) error CreateTx(asset *models.Asset, tx *sql.Tx) error Update(asset *models.Asset) error Save() error Upsert() error Delete(id int64) error GetAssetById(id int64) (res *models.Asset, err error) GetAssetByProductIDKind(productId int64, kind int) (res []*models.Asset, err error) AssetExists(storeId int64, name string) (res bool, err error) }
type CartItem ¶
type CartItem interface { SetCartItem(cartItem *models.CartItem) Exists() bool Deleted() bool Create(cartItem *models.CartItem) error Update(cartItem *models.CartItem) error Save(cartItem *models.CartItem) error Upsert(cartItem *models.CartItem) error Delete(cartId uuid.UUID, sku string, force bool) error GetByCartId(cartId uuid.UUID) ([]*models.CartItem, error) ClearItems(cartId uuid.UUID, force bool) (err error) AddItem(cartId uuid.UUID, item *models.CartItem) (res *models.CartItem, err error) UpdateQuantity(cartId uuid.UUID, sku string, quantity int) (res *models.CartItem, err error) }
type Category ¶
type Category interface { Exists() bool Deleted() bool Create(cat *models.Category) error Update(cat *models.Category) error Save() error Upsert() error Delete(id int64) error GetCategoryBySlug(storeId int64, slug string) (*models.Category, error) GetCategoryById(id int64) (*models.Category, error) GetAllCategories(storeId int64) (res *getAllCategoriesResponse, err error) }
type CategoryPair ¶
type CategoryPairs ¶
type CategoryPairs struct {
Pairs []CategoryPair
}
func (*CategoryPairs) Scan ¶
func (c *CategoryPairs) Scan(src interface{}) error
type Customer ¶
type Customer interface { Exists() bool Deleted() bool Create(customer *models.Customer) error Update(customer *models.Customer) error Save() error Upsert() error Delete(id int64) error Login(storeId int64, email, password string) (res *models.Customer, err error) GetCustomerByEmail(storeId int64, email string) (res *models.Customer, err error) }
type CustomerAddress ¶
type CustomerAddress interface { Exists() bool Deleted() bool Create(address *models.CustomerAddress) error Update(address *models.CustomerAddress) error Save() error Upsert() error Delete(id int64) error GetCustomerAddressesByCustomerIdKind(customerId int64, kind models.AddressKind) ([]*models.CustomerAddress, error) }
type CustomerPasswordReset ¶
type CustomerPasswordReset interface { Exists() bool Deleted() bool Create(customerPasswordReset *models.CustomerPasswordReset) error Update(customerPasswordReset *models.CustomerPasswordReset) error Save() error Upsert() error Redeem(token string) error GetCustomerByPasswordResetToken(token string) (res *models.Customer, err error) }
type ErrorCode ¶
type ErrorCode int
const ( SqlErrorCode ErrorCode = iota SelectErrorCode SaveErrorCode UpdateErrorCode UpsertErrorCode DeleteErrorCode HashPasswordErrorCode CustomerLoginErrorCode GetCustomerByEmailErrorCode GetStoreByIdErrorCode RedeemPasswordResetErrorCode SelectCustomerPasswordResetByTokenErrorCode SelectCustomerErrorCode )
type InventoryBrand ¶
type InventoryItem ¶
type InventoryStock ¶
type InventorySupplier ¶
type OthersBought ¶
type PagingStats ¶
type PagingStats struct { TotalRecords int64 `db:"total_records" json:"total_records"` TotalPages int64 `db:"total_pages" json:"total_pages"` }
func (*PagingStats) Calc ¶
func (s *PagingStats) Calc(pageSize int64) *PagingStats
type PostgresConfig ¶
type Product ¶
type Product interface { Exists() bool Deleted() bool Create(prod *models.Product) error Update(prod *models.Product) error Save() error Upsert() error Delete(id int64) error GetProductById(productID int64) (res *productResponse, err error) GetProductBySku(storeId int64, sku string) (res *productResponse, err error) GetProductBySlug(storeId int64, slug string) (res *productResponse, err error) GetProductsByCategoryId(storeId, categoryID, currentPage, pageSize int64, filter string) ( res *getProductsByCategoryResponse, err error, ) GetProductsByCategorySlug(storeId int64, categorySlug string, currentPage, pageSize int64, filter string) ( res *getProductsByCategoryResponse, err error, ) GetAllProducts(storeId, currentPage, pageSize int64, filter string) ( res *getAllProductsResponse, err error, ) }
type Repo ¶
type Repo interface { GetRawDB() *sqlx.DB // Repos Asset() Asset Cart() Cart CartItem() CartItem Category() Category Customer() Customer CustomerAddress() CustomerAddress CustomerPasswordReset() CustomerPasswordReset InventoryBrand() InventoryBrand InventoryItem() InventoryItem InventoryStock() InventoryStock InventorySupplier() InventorySupplier Product() Product OthersBought() OthersBought SimilarProducts() SimilarProducts Store() Store StoreSetting() StoreSetting User() User Begin() (*sql.Tx, error) Rollback(tx *sql.Tx) error Commit(tx *sql.Tx) error }
func NewRepo ¶
func NewRepo(c *PostgresConfig) Repo
type SimilarProducts ¶
type StoreSetting ¶
type User ¶
type User interface { Exists() bool Deleted() bool Create(user *models.User) error Update(user *models.User) error Save() error Upsert() error Delete(id int64) error Login(username, password string) (res *models.User, err error) GetAllPermissionGroups(currentPage, pageSize int64, sortOn string) (res *getAllPermissionGroupsResponse, err error) GetAllUsers(currentPage, pageSize int64, sortOn string) (res *getAllUsersResponse, err error) }
Source Files ¶
- asset.go
- cart.go
- cart_item.go
- category.go
- config.go
- customer.go
- customer_address.go
- customer_password_reset.go
- errors.go
- helpers.go
- inventory_brand.go
- inventory_item.go
- inventory_stock.go
- inventory_supplier.go
- others_bought.go
- product.go
- repos.go
- similar_products.go
- store.go
- store_settings.go
- types.go
- user.go
Click to show internal directories.
Click to hide internal directories.