dsdf64562672 2017-03-14 16:09 采纳率: 0%
浏览 222
已采纳

如何在golang lib / pq postgresql驱动程序中设置应用程序名称?

I'm writing a golang application and using the golang postgres driver - https://github.com/lib/pq/

I use a connection string like this

'name:pass@host:port/dbname'

I try to add aplication_name param in conn string, but this doesn't work

'name:pass@host:port/dbname?application_name=myapp'

Is it possible to set the application name from golang? (standard way)

  • 写回答

2条回答 默认 最新

  • duandaotuo5542 2017-03-14 16:16
    关注

    If you look to the documentation a application_name option is not suuported. Maybe you could use:

    fallback_application_name - An application_name to fall back to if one isn't provided.

    name:pass@host:port/dbname?fallback_application_name=myapp
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?