example

package
v0.0.0-...-e231e6d Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	SQL string
)

Functions

func NewRepository

func NewRepository(db *sql.DB) *repository

func NewService

func NewService(repo Repository) *service

Types

type Employee

type Employee struct {
	ID        int64  `json:"id"`
	Name      string `json:"name"`
	Age       int    `json:"age"`
	Address   string `json:"address"`
	CreatedAt string `json:"created_at"`
	UpdatedAt string `json:"updated_at"`
}

type GetCampaignDetailInput

type GetCampaignDetailInput struct {
	ID int `uri:"id" binding:"required"`
}

type Repository

type Repository interface {
	Create(param RequestEmployee) (Employee, error)
	GetAll() ([]Employee, error)
}

type RequestEmployee

type RequestEmployee struct {
	Name    string `json:"name" binding:"required"`
	Age     int    `json:"age" binding:"required"`
	Address string `json:"address" binding:"required"`
}

type RequestGetEmploye

type RequestGetEmploye struct {
	Name string `json:"name"`
}

type ResponseBodyData

type ResponseBodyData struct {
	ResponseCode  string     `json:"responseCode"`
	ResponseDesc  string     `json:"responseDesc"`
	ResponseData  []Employee `json:"responseData"`
	ResponseError string     `json:"responseError"`
}

type Service

type Service interface {
	Create(input RequestEmployee) (Employee, error)
	GetAll() ([]Employee, error)
	GetFromApi(ctx context.Context) ([]Employee, error)
}

Jump to

Keyboard shortcuts

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