account

package
v0.0.0-...-2246c2a Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

type Account struct {
	ID          int64          `gorm:"primaryKey" json:"id" deepcopier:"ID"`
	Name        string         `json:"name" deepcopier:"Name"`
	Type        string         `json:"type" deepcopier:"Type"`
	Description string         `json:"description" deepcopier:"Description"`
	UserID      int64          `json:"user_id" deepcopier:"UserID"`
	CreatedAt   time.Time      `json:"created_at"`
	UpdatedAt   time.Time      `json:"updated_at"`
	DeletedAt   gorm.DeletedAt `json:"deleted_at,omitempty"`
}

func (Account) TableName

func (Account) TableName() string

type GetAllAccountReq

type GetAllAccountReq struct {
	UserID int64 `json:"user_id"`
	Page   int   `json:"page"`
	Limit  int   `json:"limit"`
}

GetAllAccountReq ...

type Repository

type Repository interface {
	// CreateAccount ...
	CreateAccount(ctx context.Context, account Account) (returnData Account, err error)

	// UpdateAccount ...
	UpdateAccount(ctx context.Context, account Account) (returnData Account, err error)

	// GetAccountByID ...
	GetAccountByID(ctx context.Context, id int64) (returnData Account, err error)

	// GetAllAccount ...
	GetAllAccount(ctx context.Context, req GetAllAccountReq) (returnData []Account, err error)

	// DeleteAccount ...
	DeleteAccount(ctx context.Context, id int64) (returnData Account, err error)

	// CountTotalAccount ...
	CountTotalAccount(ctx context.Context, userID int64) (total int64, err error)
}

func NewDB

func NewDB(d *driversql.Database) Repository

func NewRepo

func NewRepo(db Repository) Repository

type Res

type Res struct {
	ID          int64     `json:"id" deepcopier:"ID"`
	Name        string    `json:"name" deepcopier:"Name"`
	Type        string    `json:"type" deepcopier:"Type"`
	Description string    `json:"description" deepcopier:"Description"`
	UserID      int64     `json:"user_id" deepcopier:"UserID"`
	CreatedAt   time.Time `json:"created_at"`
	UpdatedAt   time.Time `json:"updated_at"`
}

Jump to

Keyboard shortcuts

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