valueObjects

package
v0.0.0-...-b820d78 Latest Latest
Warning

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

Go to latest
Published: May 1, 2021 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddUnique

func AddUnique(ctx context.Context, c *redis.Client, key string, value string) *redis.IntCmd

Add Unique key

set key uk_user[FieldName] for user table
set key uk_event[FieldName] for event table
set key uk_transaction[FieldName] for transaction table

func CheckUnique

func CheckUnique(ctx context.Context, c *redis.Client, key string, value string) ([]string, error)

"*\"fathimzr\"*"

func DelUnique

func DelUnique(ctx context.Context, c *redis.Client, key string, value string) *redis.IntCmd

Remove Unique key

set key uk_user[FieldName] for user table
set key uk_event[FieldName] for event table
set key uk_transaction[FieldName] for transaction table

func GetIndex

func GetIndex(ctx context.Context, c *redis.Client, key string) (int, error)

Get index for key

set key idx_user for user table
set key idx_event for event table
set key idx_transaction for transaction table

func SetIndex

func SetIndex(ctx context.Context, c *redis.Client, key string, value int) *redis.Cmd

Set index for key

set key idx_user for user table
set key idx_event for event table
set key idx_transaction for transaction table

Types

type Event

type Event struct {
	ID                int            `json:"id" form:"id"`
	CreatorId         int            `json:"creator_id" form:"creator_id"`
	TitleEvent        string         `json:"title_event" form:"title_event"`
	LinkWebinar       string         `json:"link_webinar" form:"link_webinar"`
	Description       string         `json:"description" form:"description"`
	TypeEvent         string         `json:"type_event" form:"type_event"`
	Banner            string         `json:"banner" form:"banner"`
	Price             float64        `json:"price" form:"price"`
	Quantity          int            `json:"quantity" form:"quantity"`
	Status            string         `json:"status" form:"status"`
	EventStartDate    *time.Time     `json:"event_start_date" form:"event_start_date" time_format:"2006-01-02"`
	EventEndDate      *time.Time     `json:"event_end_date" form:"event_end_date" time_format:"2006-01-02"`
	CampaignStartDate *time.Time     `json:"campaign_start_date" form:"campaign_start_date" time_format:"2006-01-02"`
	CampaignEndDate   *time.Time     `json:"campaign_end_date" form:"campaign_end_date" time_format:"2006-01-02"`
	DeletedAt         gorm.DeletedAt `json:"deleted_at" form:"deleted_at" time_format:"unixNano"`
	CreatedAt         time.Time      `json:"created_at" form:"created_at" time_format:"unixNano"`
	UpdatedAt         time.Time      `json:"updated_at" form:"updated_at" time_format:"unixNano"`
}

type EventVO

type EventVO interface {
	CreateEvent(ctx context.Context, c *redis.Client) (entity.Event, error)
	GetEvent(ctx context.Context, c *redis.Client, key string) (entity.Event, error)
	GetAllEvent(ctx context.Context, c *redis.Client) ([]entity.Event, error)
}

func NewEventVO

func NewEventVO(ev *entity.Event) EventVO

type Transaction

type Transaction struct {
	ID            int            `json:"id,string" form:"id"`
	ParticipantId int            `json:"participant_id,string" form:"participant_id"`
	CreatorId     int            `json:"creator_id,string" form:"creator_id"`
	EventId       int            `json:"event_id,string" form:"event_id"`
	Amount        float64        `json:"amount,string" form:"amount"`
	StatusPayment string         `json:"status_payment" form:"status_payment"`
	DeletedAt     gorm.DeletedAt `json:"deleted_at" form:"deleted_at" time_format:"unixNano"`
	CreatedAt     time.Time      `json:"created_at" form:"created_at" time_format:"unixNano"`
	UpdatedAt     time.Time      `json:"updated_at" form:"updated_at" time_format:"unixNano"`
}

type TransactionVO

type TransactionVO interface {
	CreateTransaction(ctx context.Context, c *redis.Client) (entity.Transaction, error)
	UpdateTransaction(ctx context.Context, c *redis.Client) (entity.Transaction, error)
	GetTransaction(ctx context.Context, c *redis.Client, key string) (entity.Transaction, error)
}

func NewTransactionVO

func NewTransactionVO(trx *entity.Transaction) TransactionVO

type User

type User struct {
	ID       int    `json:"id,string"`
	Username string `json:"username" validate:"username"`
	Fullname string `json:"fullname"`
	Email    string `json:"email" validate:"email"`
	// EmailVerifiedAt string `json:"email_verified_at"`
	Password  string `json:"password"`
	Role      string `json:"role"`
	DeletedAt int64  `json:"deleted_at,string"`
	CreatedAt int64  `json:"created_at,string"`
	UpdatedAt int64  `json:"updated_at,string"`
}

type UserVO

type UserVO interface {
	GetUser(ctx context.Context, c *redis.Client, key string) (entity.User, error)
	GetAllUser(ctx context.Context, c *redis.Client) ([]entity.User, error)
	InsertUser(ctx context.Context, c *redis.Client) (int64, error)
	UpdateUser(ctx context.Context, c *redis.Client) (int64, error)
	FindUser(ctx context.Context, c *redis.Client, value string) error
}

func NewUserVO

func NewUserVO(u *entity.User) UserVO

Jump to

Keyboard shortcuts

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