kurly

package
v1.2.6 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2026 License: MIT Imports: 22 Imported by: 0

Documentation ΒΆ

Overview ΒΆ

Example (Render) ΒΆ

Example_render demonstrates usage of Render and RenderDiff methods.

p := &product{
	ID:              12345,
	Name:            "Example Item",
	Price:           10000,
	DiscountedPrice: 9000,
	DiscountRate:    10,
}
prev := &product{
	Price: 11000, // Previous was more expensive
}

// 1. Basic Render
fmt.Println("--- Render ---")
fmt.Println(renderProduct(p, false, ""))

// 2. Diff Render
fmt.Println("\n--- RenderDiff ---")
fmt.Println(formatProductItem(p, false, mark.Mark("πŸ“‰"), prev))
Output:
--- Render ---
☞ Example Item
      β€’ ν˜„μž¬ 가격 : 10,000원 β‡’ 9,000원 (10%)

--- RenderDiff ---
☞ Example Item πŸ“‰
      β€’ ν˜„μž¬ 가격 : 10,000원 β‡’ 9,000원 (10%)
      β€’ 이전 가격 : 11,000원

Index ΒΆ

Examples ΒΆ

Constants ΒΆ

View Source
const (
	// TaskID λ§ˆμΌ“μ»¬λ¦¬(https://www.kurly.com/) μ„œλΉ„μŠ€μ™€ μ—°λ™λ˜λŠ” Task의 고유 μ‹λ³„μžμž…λ‹ˆλ‹€.
	TaskID contract.TaskID = "KURLY"

	// WatchProductPriceCommand λ§ˆμΌ“μ»¬λ¦¬ μƒν’ˆμ˜ 가격 λ³€ν™”λ₯Ό κ°μ‹œν•˜λŠ” Command의 고유 μ‹λ³„μžμž…λ‹ˆλ‹€.
	// 이 CommandλŠ” μ§€μ •λœ μƒν’ˆ λͺ©λ‘μ„ 주기적으둜 μŠ€ν¬λž˜ν•‘ν•˜μ—¬ 가격 변동을 μΆ”μ ν•˜κ³ ,
	// λ³€ν™”κ°€ κ°μ§€λ˜λ©΄ ν…”λ ˆκ·Έλž¨ 등을 톡해 μ•Œλ¦Όμ„ μ „μ†‘ν•©λ‹ˆλ‹€.
	WatchProductPriceCommand contract.TaskCommandID = "WatchProductPrice"
)

Variables ΒΆ

View Source
var (
	// ErrWatchListFileEmpty watch_list_file 섀정이 μ‘΄μž¬ν•˜μ§€ μ•Šκ±°λ‚˜ 곡백일 λ•Œ λ°˜ν™˜ν•©λ‹ˆλ‹€.
	ErrWatchListFileEmpty = apperrors.New(apperrors.InvalidInput, "watch_list_file이 μ„€μ •λ˜μ§€ μ•Šμ•˜κ±°λ‚˜ κ³΅λ°±μž…λ‹ˆλ‹€")

	// ErrWatchListFileNotCSV watch_list_file κ²½λ‘œκ°€ .csv ν™•μž₯자둜 λλ‚˜μ§€ μ•Šμ„ λ•Œ λ°˜ν™˜ν•©λ‹ˆλ‹€.
	ErrWatchListFileNotCSV = apperrors.New(apperrors.InvalidInput, "watch_list_file은 .csv 파일 κ²½λ‘œμ—¬μ•Ό ν•©λ‹ˆλ‹€")

	// ErrCSVStreamReadFailed CSV 슀트림의 첫 λ°”μ΄νŠΈλ₯Ό μ½λŠ” 쀑 였λ₯˜κ°€ λ°œμƒν–ˆμ„ λ•Œ λ°˜ν™˜λ˜λŠ” μ—λŸ¬μž…λ‹ˆλ‹€.
	ErrCSVStreamReadFailed = apperrors.New(apperrors.InvalidInput, "CSV 슀트림의 μ‹œμž‘ 뢀뢄을 μ½λŠ” 쀑 였λ₯˜κ°€ λ°œμƒν–ˆμŠ΅λ‹ˆλ‹€. 데이터가 λΉ„μ–΄μžˆκ±°λ‚˜ μ˜¬λ°”λ₯΄μ§€ μ•Šμ€ 인코딩일 수 μžˆμŠ΅λ‹ˆλ‹€")

	// ErrBOMRecovery BOM 검사 ν›„ 버퍼λ₯Ό μ›λž˜ μƒνƒœλ‘œ λ³΅κ΅¬ν•˜μ§€ λͺ»ν–ˆμ„ λ•Œ λ°˜ν™˜λ˜λŠ” μ—λŸ¬μž…λ‹ˆλ‹€.
	ErrBOMRecovery = apperrors.New(apperrors.Internal, "BOM(Byte Order Mark) 검사 ν›„ 버퍼 μƒνƒœλ₯Ό λ³΅κ΅¬ν•˜λŠ” 쀑 였λ₯˜κ°€ λ°œμƒν–ˆμŠ΅λ‹ˆλ‹€")

	// ErrCSVParse CSV 데이터 νŒŒμ‹± 쀑 였λ₯˜κ°€ λ°œμƒν–ˆμ„ λ•Œ λ°˜ν™˜λ˜λŠ” μ—λŸ¬μž…λ‹ˆλ‹€.
	ErrCSVParse = apperrors.New(apperrors.InvalidInput, "CSV 데이터 νŒŒμ‹± 쀑 였λ₯˜κ°€ λ°œμƒν–ˆμŠ΅λ‹ˆλ‹€. 파일 μΈμ½”λ”©μ΄λ‚˜ ν˜•μ‹μ„ 확인해 μ£Όμ„Έμš”")

	// ErrCSVEmpty CSV νŒŒμΌμ„ μ„±κ³΅μ μœΌλ‘œ μ½μ—ˆμ§€λ§Œ μ‹€μ œ 행이 ν•œ 건도 없을 λ•Œ λ°˜ν™˜λ˜λŠ” μ—λŸ¬μž…λ‹ˆλ‹€.
	ErrCSVEmpty = apperrors.New(apperrors.InvalidInput, "CSV 데이터가 λΉ„μ–΄μžˆμŠ΅λ‹ˆλ‹€. 파일 λ‚΄μš©μ„ 확인해 μ£Όμ„Έμš”")

	// ErrCSVInvalidHeader CSV 파일의 첫 번째 ν–‰(헀더)의 컬럼 μˆ˜κ°€ λΆ€μ‘±ν•  λ•Œ λ°˜ν™˜λ˜λŠ” μ—λŸ¬μž…λ‹ˆλ‹€.
	ErrCSVInvalidHeader = apperrors.New(apperrors.InvalidInput, "CSV 헀더 ν˜•μ‹μ΄ μ˜¬λ°”λ₯΄μ§€ μ•ŠμŠ΅λ‹ˆλ‹€. ν•„μˆ˜ 컬럼(no, name, status)이 ν¬ν•¨λ˜μ–΄ μžˆλŠ”μ§€ 확인해 μ£Όμ„Έμš”")

	// ErrCSVAllRecordsFiltered CSV 파일의 λͺ¨λ“  데이터 행이 ν•„ν„°λ§λ˜μ–΄ μœ νš¨ν•œ μƒν’ˆ λ ˆμ½”λ“œκ°€ ν•œ 건도 남지 μ•Šμ•˜μ„ λ•Œ λ°˜ν™˜λ˜λŠ” μ—λŸ¬μž…λ‹ˆλ‹€.
	ErrCSVAllRecordsFiltered = apperrors.New(apperrors.InvalidInput, "μ²˜λ¦¬ν•  수 μžˆλŠ” μœ νš¨ν•œ μƒν’ˆ λ ˆμ½”λ“œκ°€ μ—†μŠ΅λ‹ˆλ‹€. λͺ¨λ“  행이 ν•„μˆ˜ 데이터(μƒν’ˆλ²ˆν˜Έ, μƒν’ˆλͺ…) λˆ„λ½μœΌλ‘œ 인해 ν•„ν„°λ§λ˜μ—ˆμŠ΅λ‹ˆλ‹€")
)

Functions ΒΆ

This section is empty.

Types ΒΆ

type WatchListLoader ΒΆ

type WatchListLoader interface {
	// Load 데이터 μ†ŒμŠ€λ‘œλΆ€ν„° κ°μ‹œ λŒ€μƒ μƒν’ˆ λ ˆμ½”λ“œ λͺ©λ‘μ„ 읽어 λ°˜ν™˜ν•©λ‹ˆλ‹€.
	//
	// λ°˜ν™˜λ˜λŠ” [][]string의 각 μ›μ†ŒλŠ” ν•˜λ‚˜μ˜ μƒν’ˆ λ ˆμ½”λ“œμ΄λ©°,
	// columnID, columnName, columnStatus 인덱슀둜 각 ν•„λ“œμ— μ ‘κ·Όν•©λ‹ˆλ‹€.
	Load() ([][]string, error)
}

WatchListLoader κ°μ‹œ λŒ€μƒ μƒν’ˆ λͺ©λ‘μ„ λ‘œλ“œν•˜λŠ” μΈν„°νŽ˜μ΄μŠ€μž…λ‹ˆλ‹€.

데이터 μ†ŒμŠ€(CSV 파일, λ°μ΄ν„°λ² μ΄μŠ€, 원격 API λ“±)λ₯Ό μΆ”μƒν™”ν•˜μ—¬ μ‹€ν–‰ 둜직이 데이터 μΆœμ²˜μ— μ˜μ‘΄ν•˜μ§€ μ•Šλ„λ‘ λΆ„λ¦¬ν•©λ‹ˆλ‹€. ν…ŒμŠ€νŠΈ μ‹œμ—λŠ” 이 μΈν„°νŽ˜μ΄μŠ€λ₯Ό κ΅¬ν˜„ν•œ Mock을 μ£Όμž…ν•˜μ—¬ 파일 I/O 없이 검증할 수 μžˆμŠ΅λ‹ˆλ‹€.

func NewCSVWatchListLoader ΒΆ

func NewCSVWatchListLoader(filePath string) WatchListLoader

NewCSVWatchListLoader μ£Όμ–΄μ§„ filePath의 CSV νŒŒμΌμ„ μ½λŠ” WatchListLoaderλ₯Ό μƒμ„±ν•©λ‹ˆλ‹€.

Jump to

Keyboard shortcuts

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