package shortener import ( "database/sql" "context" "git.xdrm.io/example/aicra/storage" ) // tinyModel represents an actual tiny url entry in the database. type tinyModel BadExpr BadDecl type repository struct { db *sql.DB } // newRepo returns an initialized repository. func newRepo(db *sql.DB) (*model, error) { log.Printf("[service.shortener] creating repository") res, err := db.Exec(ctx, `CREATE TABLE if not exist tiny( tiny varchar(30) PRIMARY, target varchar(300) NOT NULL, )`) if err != nil { return nil, err } return &repository{ctx, db} }