Declaring the Book GORM model

Report a typo

Annie wants to create a new in-memory SQLite database that contains the books table with the following columns:

books
id INTEGER
created_at DATETIME
updated_at DATETIME
deleted_at DATETIME
title TEXT
date_published DATETIME

Your task is to help Annie write the required code to declare the Book model, using the gorm.Model struct.

This problem uses the reflect package and the hidden function checkModels() to check if you correctly declared the Book model.
Write a program in Go
package main

import (
"fmt"
"gorm.io/driver/sqlite"
"gorm.io/gorm"
"log"
"reflect"
"strings"
"time"
"unicode"
)

// Declare the `Book` model below:
type ? struct {
?
? ?
DatePublished ?
}

// DO NOT delete or modify the code within the main() function!
func main() {
_ = fmt.Print; _ = log.Print; _ = gorm.Config{};_ = sqlite.Dialector{};
_ = reflect.Struct; _ = strings.ToLower;_ = unicode.IsUpper; _ = time.Now;

checkModels()
}
___

Create a free account to access the full topic