Some checks failed
Build Push and Restart Compose / deploy (push) Failing after 1m47s
- `github.com/lib/pq` PostgreSQL 드라이버 vendor 디렉토리에 추가. - PostgreSQL 관련 내부 패키지(`pqsql`, `proto`, `pqtime`, `pgpass`, `pgservice`, `pqutil`) 구현: - SQL 어휘 처리, 프로토콜 상수 및 구조 정의, 시간 파서/포맷터(`Parse`, `Format`). - `.pgpass` 파일 및 `pg_service.conf` 관리 기능 추가. - 파일/사용자 권한 검증 및 플랫폼별 사용자 정보 조회 기능 포함. - 데이터베이스 초기화 로직 추가 (`services/db.go`): - PostgreSQL 연결 설정 및 초기 스키마 생성. - 자동매매 관련 DB 레포지토리(`services/autotrade_repo.go`) 구현: - 자동매매 규칙 및 포지션 관리 로직 추가 (`dbInsertRule`, `dbLoadRules` 등).
33 lines
673 B
Go
33 lines
673 B
Go
package pqutil
|
|
|
|
import (
|
|
"strconv"
|
|
"strings"
|
|
)
|
|
|
|
// ParseBool is like strconv.ParseBool, but also accepts "yes"/"no" and
|
|
// "on"/"off".
|
|
func ParseBool(str string) (bool, error) {
|
|
switch str {
|
|
case "1", "t", "T", "true", "TRUE", "True", "yes", "on":
|
|
return true, nil
|
|
case "0", "f", "F", "false", "FALSE", "False", "no", "off":
|
|
return false, nil
|
|
}
|
|
return false, &strconv.NumError{Func: "ParseBool", Num: str, Err: strconv.ErrSyntax}
|
|
}
|
|
|
|
func Join[S ~[]E, E ~string](s S) string {
|
|
var b strings.Builder
|
|
for i := range s {
|
|
if i > 0 {
|
|
b.WriteString(", ")
|
|
}
|
|
if i == len(s)-1 {
|
|
b.WriteString("or ")
|
|
}
|
|
b.WriteString(string(s[i]))
|
|
}
|
|
return b.String()
|
|
}
|