-1
데이터 스토어 클라이언트에 대해 전역을 어떻게 선언 하시겠습니까?Google 데이터 스토어 글로벌 연결
지금까지 내가 가진 :
var (
db driver.Conn
ctx context.Context
client datastore.Client
)
이 DB를 무시합니다. 내 글로벌 db conn입니다.
func bootstrap() {
ctx = context.Background()
pId := ProjectId
var err error
client, err = datastore.NewClient(ctx, pId)
if err != nil {
fmt.Printf("caught error:%v\n", err)
}
}
내 오류는 다음과 같습니다 은 다중 할당
에서 클라이언트 (유형 "cloud.google.com/go/datastore".Client)에 *"cloud.google.com/go/datastore ".Client을 할당 할 수 없습니다
https://godoc.org/cloud.google.com/go/datastore#NewClient는 '* 클라이언트'와 '오류'를 반환합니다. – RayfenWindspear
또한 전역 컨텍스트가 없어야합니다. 그건 말이 안되요. – RayfenWindspear