database

package
v0.0.0-...-76e48d7 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Copyright 2022 Google LLC

# # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License.

Copyright 2022 Google LLC

# # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License.

Copyright 2022 Google LLC

# # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License.

Copyright 2022 Google LLC

# # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License.

Copyright 2022 Google LLC

# # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License.

Copyright 2022 Google LLC

# # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License.

Copyright 2022 Google LLC

# # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License.

Copyright 2022 Google LLC

# # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	DB *gorm.DB
}

func (Client) AddCategory

func (c Client) AddCategory(ctx context.Context, category *models.Category) (*models.Category, error)

func (Client) AddItemToCart

func (c Client) AddItemToCart(ctx context.Context, cartId string, productId string) (bool, error)

func (Client) AddProduct

func (c Client) AddProduct(ctx context.Context, product *models.Product) (*models.Product, error)

func (Client) AddUser

func (c Client) AddUser(ctx context.Context, user *models.User) (*models.User, error)

func (Client) AddUserAddress

func (c Client) AddUserAddress(ctx context.Context, userAddress *models.UserAddress) (*models.UserAddress, error)

func (Client) AllProducts

func (c Client) AllProducts(ctx context.Context) ([]models.Product, error)

func (Client) CloseConnection

func (c Client) CloseConnection()

func (Client) DeleteCategory

func (c Client) DeleteCategory(ctx context.Context, ID string) error

func (Client) DeleteProduct

func (c Client) DeleteProduct(ctx context.Context, ID string) error

func (Client) DeleteUser

func (c Client) DeleteUser(ctx context.Context, ID string) error

func (Client) DeleteUserAddress

func (c Client) DeleteUserAddress(ctx context.Context, ID string) error

func (Client) GetCartInfoByUserID

func (c Client) GetCartInfoByUserID(ctx context.Context, userId string) (*models.Cart, int64, error)

func (Client) GetCategoryById

func (c Client) GetCategoryById(ctx context.Context, ID string) (*models.Category, error)

func (Client) GetProductById

func (c Client) GetProductById(ctx context.Context, ID string) (*models.Product, error)

func (Client) GetUserAddressById

func (c Client) GetUserAddressById(ctx context.Context, ID string) (*models.UserAddress, error)

func (Client) GetUserById

func (c Client) GetUserById(ctx context.Context, ID string) (*models.DisplayUser, error)

func (Client) Login

func (c Client) Login(ctx context.Context, user *models.Login) (string, error)

func (Client) NewCartForUser

func (c Client) NewCartForUser(ctx context.Context, cart *models.Cart) (*models.Cart, error)

func (Client) OrderList

func (c Client) OrderList(ctx context.Context, userId string) ([]models.Order, error)

func (Client) OrderPlacement

func (c Client) OrderPlacement(ctx context.Context, userId string) (bool, error)

func (Client) Ready

func (c Client) Ready() bool

func (Client) RunMigration

func (c Client) RunMigration() error

func (Client) UpdateCategory

func (c Client) UpdateCategory(ctx context.Context, category *models.Category) (bool, error)

func (Client) UpdateProduct

func (c Client) UpdateProduct(ctx context.Context, product *models.UpdateProduct, productId string) (*models.Product, error)

func (Client) UpdateUser

func (c Client) UpdateUser(ctx context.Context, user *models.User) (bool, error)

func (Client) UpdateUserAddress

func (c Client) UpdateUserAddress(ctx context.Context, userAddress *models.UserAddress) (bool, error)

type DBClient

type DBClient interface {
	Ready() bool
	RunMigration() error
	CloseConnection()
	abstract.Authenticate
	abstract.User
	abstract.UserAddress
	abstract.Product
	abstract.Category
	abstract.Cart
	abstract.Order
}

func NewDBClient

func NewDBClient() (DBClient, error)

func NewTestDBClient

func NewTestDBClient() (DBClient, error)

Jump to

Keyboard shortcuts

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