MCPcopy Create free account
hub / github.com/cloud-native-go/examples / createTable

Method createTable

ch05/ch05_08/pglogger.go:161–177  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

159}
160
161func (l *PostgresTransactionLogger) createTable() error {
162 var err error
163
164 createQuery := `CREATE TABLE transactions (
165 sequence BIGSERIAL PRIMARY KEY,
166 event_type SMALLINT,
167 key TEXT,
168 value TEXT
169 );`
170
171 _, err = l.db.Exec(createQuery)
172 if err != nil {
173 return err
174 }
175
176 return nil
177}
178
179func NewPostgresTransactionLogger(param PostgresDbParams) (TransactionLogger, error) {
180 connStr := fmt.Sprintf("host=%s dbname=%s user=%s password=%s sslmode=disable",

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected