Context 패키지 (이론)
패키지 구성
Package context defines the Context type, which carries deadlines, cancellation signals, and other request-scoped values across API boundaries and between processes.
컨텍스트 패키지는 Context 타입을 구현하고 있는 패키지입니다. 이 컨텍스트 타입은 인터페이스로 실제로는 하부에 크게 5가지 타입의 컨텍스트 구현체가 존재합니다.
컨텍스트 종류
- 아무 상태도 가지지 않은,
backgroundCtx와todoCtx - 취소 시그널을 보내거나 무시할 수 있는,
cancelCtx와withoutCancelCtx - 특정 시간만 동작하거나 특정 시각까지만 동작하는,
timerCtx - 키와 값을 저장하는,
valueCtx - 사후 처리를 담당하는,
afterFuncCtx
backgroud, todo
아마 세상에서 가장 많이 쓰이는 컨텍스트입니다.