Preparations
- Golang version: 1.13 or later.
- Database environment:
- Go driver environment:
Refer to "Application Development Guide > Development Based on the Go Driver > Development Procedure > Preparing the Environment" in Developer Guide.
- Environment variables needed by code:
Taking Linux environments as an example:
export GOHOSTIP='127.0.0.1' # IP address. Adjust it based on the actual services. export GOPORT='5432' # Port number. Adjust it based on the actual services. export GOUSRNAME='test_user' # Name of a database user. Adjust it based on the actual services. export GOPASSWD='xxxxxxxx' # Password for the database user. Adjust it based on the actual services. export GODBNAME='gaussdb' # Database name. Adjust it based on the actual services. export GOCONNECT_TIMEOUT='3' # Timeout interval for database connection. Adjust it based on the actual services. export GOSOCKET_TIMEOUT='1' # Timeout interval for a single SQL statement. Adjust it based on the actual services. export GOSSLMODE='verify-full' # Specifies whether to enable SSL encryption. Adjust it based on the actual services. export GOROOTCERT='certs/cacert.pem' # Path to the root certificate. Adjust it based on the actual services. export GOSSLKEY='certs/client-key.pem' # Path to the client key. Adjust it based on the actual services. export GOSSLCERT='certs/client-cert.pem' # Path to the client certificate. Adjust it based on the actual services.
Adjust the values of environment variables as needed. However, if your code does not intend to obtain connection parameter values from environment variables, you may skip this step.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot