Skip to content

Commit

Permalink
Add DB API, fix a little
Browse files Browse the repository at this point in the history
  • Loading branch information
H1rono committed Jun 16, 2022
1 parent 4581bd8 commit 01dabab
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ require (
)

require (
github.com/go-sql-driver/mysql v1.6.0 // indirect
github.com/go-sql-driver/mysql v1.6.0
github.com/labstack/gommon v0.3.1 // indirect
github.com/mattn/go-colorable v0.1.11 // indirect
github.com/mattn/go-isatty v0.0.14 // indirect
Expand Down
12 changes: 12 additions & 0 deletions model/code.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
package model

import (
"context"
)

// | USER_NAME | HASH | PLAIN_CODE | STDIN | TITLE | OPTIONS | CREATED_AT |
// | ----------- | ------- | ---------- | -------- | ----------- | -------- | --- |
// | VARCHAR(32) | CHAR(8) | TEXT | TEXT | VARCHAR(64) | TEXT | TIMESTAMP |
Expand All @@ -13,3 +17,11 @@ type Code struct {
Title string
Options string
}

func AddCode(ctx context.Context, code *Code) error {
return nil
}

func GetCode(ctx context.Context, userName string, hash string) (*Code, error) {
return nil, nil
}
1 change: 1 addition & 0 deletions model/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package model
import (
"fmt"
"os"

_ "github.com/go-sql-driver/mysql"
"github.com/jmoiron/sqlx"
)
Expand Down

0 comments on commit 01dabab

Please sign in to comment.