Skip to content

Tarik Billa

  • Web Development
    • html
    • vue.js
    • laravel
    • css
    • javascript
    • jquery
    • node.js
    • php
    • asp.net
  • Programming
    • python
    • java
    • c
    • c++
    • c#
  • git
  • android

sqlx

Efficiently mapping one-to-many many-to-many database to struct in Golang

July 27, 2023 by Tarik

the sql in postgres : create schema temp; set search_path = temp; create table item ( id INT generated by default as identity primary key ); create table tag ( id INT generated by default as identity primary key, name VARCHAR(160), item_id INT references item (id) ); create view item_tags as select id, ( select … Read more

Categories sql Tags go, sql, sqlx, struct Leave a comment

Go: How to get last insert id on Postgresql with NamedExec()

July 24, 2023 by Tarik

The reason for this is because PostgreSQL does not return you the last inserted id. This is because last inserted id is available only if you create a new row in a table that uses a sequence. If you actually insert a row in the table where a sequence is assigned, you have to use … Read more

Categories postgresql Tags go, postgresql, sqlx Leave a comment

unsupported Scan, storing driver.Value type []uint8 into type *time.Time

June 30, 2023 by Tarik

Alright, I found the solution, thanks this answer. The problem goes by adding ?parseTime=true to the db mapper. Like this: db, err := sqlx.Connect(“mysql”, “myuser:mypass@tcp(127.0.0.1:3306)/mydb?parseTime=true”)

Categories mysql Tags go, mysql, sqlx Leave a comment

Tarik Billa

Software Engineer
tarikbilla@gmail.com
+8801884414000
  • Reuse a hash in YAMLApril 17, 2024
  • Dockerfile: how to redirect the output of a RUN command to a variable?April 16, 2024
  • How to cd to a directory with spaces in the directory name?April 16, 2024
  • Maximum MIME type length when storing the type in a databaseApril 16, 2024
  • What is the difference between Unit, Integration, Regression and Acceptance Testing?April 16, 2024
© 2026 Tarik Billa