type User struct { ID int64 `db:"id"` Name string `db:"name"` } func main() { dbmap := initDb() defer dbmap.Db.Close() user := User{Name: "John Doe"} err := dbmap.Insert(&user) if err != nil { log.Fatalf("Error inserting user: %v", err) } log.Printf("User inserted with ID: %d", user.ID) } func initDb() *gorp.DbMap { db, err := sql.Open("postgres", "user=postgres password=postgres dbname=test sslmode=disable") if err != nil { log.Fatalf("Error opening database connection: %v", err) } dbmap := &gorp.DbMap{Db: db, Dialect: gorp.PostgresDialect{}} dbmap.AddTableWithName(User{}, "users").SetKeys(true, "ID") err = dbmap.CreateTablesIfNotExists() if err != nil { log.Fatalf("Error initializing database tables: %v", err) } return dbmap }In this example, we create a User struct with an ID and Name attribute. We then initialize a connection to a Postgres database using the Gorp ORM library and insert the User object into the database using the SqlExecutor Insert method. If the insertion is successful, the ID assigned by the database is printed to the console.