项目作者: savaki

项目描述 :
golang sql driver for aws data api
高级语言: Go
项目地址: git://github.com/savaki/dapi.git
创建时间: 2020-07-28T17:45:15Z
项目社区:https://github.com/savaki/dapi

开源协议:Apache License 2.0

下载


dapi

dapi is a Go sql.Driver for the AWS RDS Data API

Motivation

I wanted to the productivity of using gorm combined with the utility of
convenience of the RDS Data API. Looking around, I couldn’t find anything that fit
the bill and hence, dapi

QuickStart

dapi is intended to work as a standard golang sql.Driver and specifically as a driver
usable by gorm

  1. func main() {
  2. var (
  3. s = session.Must(session.NewSession(aws.NewConfig()))
  4. api = rdsdataservice.New(s)
  5. driver = dapi.New(api)
  6. database = "the database name"
  7. secretARN = "secret arn holding database credentials"
  8. resourceARN = "resource arn"
  9. dsn = fmt.Sprintf("secret=%v resource=%v database=%v", secretARN, resourceARN, database)
  10. dialect = "mysql"
  11. )
  12. sql.Register(dialect, driver)
  13. db, err := gorm.Open(dialect, dsn)
  14. // at this point you can use gorm as you normally would
  15. }

Maturity

This project is very new and should not be used for production. Your mileage may vary.