deduction_setting

package
v1.0.55 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Migrate

func Migrate(db *gorm.DB) error

Migrate creates the necessary database schema for DeductionSettingModel.

It takes a GORM database instance as parameter and returns an error if the migration process encounters any issues.

Parameters:

db (*gorm.DB): The GORM database instance.

Returns:

error: An error if the migration process fails; otherwise nil.

Types

type DeductionSettingService

type DeductionSettingService struct {
	// contains filtered or unexported fields
}

func NewDeductionSettingService

func NewDeductionSettingService(ctx *context.ERPContext) *DeductionSettingService

func (*DeductionSettingService) Create

func (s *DeductionSettingService) Create(deductionSetting *models.DeductionSettingModel) error

func (*DeductionSettingService) Delete

func (s *DeductionSettingService) Delete(id string) error

Delete deletes a deduction setting from the database.

The function takes the ID of the deduction setting as a parameter and attempts to delete it from the database. If the deletion is successful, the function returns nil; otherwise, it returns an error object indicating what went wrong.

Parameters:

id (string): The ID of the deduction setting to be deleted.

Returns:

error: An error object if the deletion fails, or nil if successful.

func (*DeductionSettingService) FindAll

func (a *DeductionSettingService) FindAll(request *http.Request) (paginate.Page, error)

FindAll retrieves all deduction settings from the database.

The function takes an HTTP request object as parameter and uses the query parameters to filter the deduction settings. The records are sorted by ID in descending order by default, but the order can be changed by specifying the "order" query parameter.

The function returns a Page object containing the deduction settings and the pagination information. The Page object contains the following fields:

Records: []models.DeductionSettingModel
Page: int
PageSize: int
TotalPages: int
TotalRecords: int

If the operation is not successful, the function returns an error object.

func (*DeductionSettingService) FindOne

func (*DeductionSettingService) Update

func (s *DeductionSettingService) Update(deductionSetting *models.DeductionSettingModel) error

Update updates an existing deduction setting in the database.

The function takes a pointer to a DeductionSettingModel as a parameter and attempts to update the corresponding deduction setting in the database. If the operation is successful, the function returns nil; otherwise, it returns an error indicating what went wrong.

Parameters:

deductionSetting (*models.DeductionSettingModel): The deduction setting
  model instance to be updated.

Returns:

error: An error object if the update operation fails, or nil if it is
  successful.

Jump to

Keyboard shortcuts

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