Created
March 15, 2023 05:48
-
-
Save crashmax-dev/644c412834a9a0221a31c85251cb2b26 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"github.com/rprtr258/simpdb" | |
) | |
type Emote struct { | |
Name string `json:"name"` | |
Link string `json:"link"` | |
} | |
func (e Emote) ID() string { | |
return e.Name | |
} | |
func (Emote) TableName() string { | |
return "emotes" | |
} | |
func main() { | |
db := simpdb.New("db") | |
emotes := simpdb.GetTable[Emote](db) | |
_, err := emotes.GetAll() | |
if err != nil { | |
fmt.Println(err) | |
} | |
err = emotes.Insert(Emote{ | |
Name: "Madge", | |
Link: "https://cdn.7tv.app/emote/60a95f109d598ea72fad13bd/4x.webp", | |
}) | |
if err != nil { | |
fmt.Println(err) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment