Documentation ¶
Overview ¶
Models keep track of data processing, such as returning slices for complex queries, or sanitizing input data
Index ¶
- Variables
- func CreateSyllabiTable() error
- func DeleteAttachment(id int) error
- func DeleteSyllabus(id int) error
- func DeleteToken(id int) error
- func InitDB(url string) (*bun.DB, error)
- func RemoveFixtures(t *testing.T)
- func RunFixtures(db *bun.DB, dir string) error
- func Shutdown() error
- type Attachment
- type Contributor
- type MagicToken
- type Syllabus
Constants ¶
This section is empty.
Variables ¶
View Source
var (
Basepath = filepath.Dir(b)
)
Functions ¶
func CreateSyllabiTable ¶
func CreateSyllabiTable() error
func DeleteAttachment ¶
func DeleteSyllabus ¶
func DeleteToken ¶
func RemoveFixtures ¶
Types ¶
type Attachment ¶
type Attachment struct { CreatedAt time.Time `bun:",nullzero,notnull,default:current_timestamp"` UpdatedAt time.Time `bun:",nullzero,notnull,default:current_timestamp"` ID int64 `bun:"id,pk,autoincrement"` Name string `bun:"name,notnull" form:"name"` File []byte `bun:"file,notnull"` Type string `bun:"type,notnull"` SyllabusAttachedID int64 `yaml:"syllabus_attached_id"` }
func AddNewAttachment ¶
func AddNewAttachment(att *Attachment) (Attachment, error)
func GetAllAttachments ¶
func GetAllAttachments() ([]Attachment, error)
func GetAttachment ¶
func GetAttachment(id int) (Attachment, error)
func UpdateAttachment ¶
func UpdateAttachment(id int, att *Attachment) (Attachment, error)
type Contributor ¶
type Contributor struct { CreatedAt time.Time `bun:",nullzero,notnull,default:current_timestamp"` UpdatedAt time.Time `bun:",nullzero,notnull,default:current_timestamp"` ID int64 `bun:"id,pk,autoincrement"` Name string `bun:"name,notnull"` Email string `bun:"email,notnull,unique"` Syllabi []*Syllabus `bun:"rel:has-many" form:"syllabi" json:"syllabi"` }
type MagicToken ¶
type MagicToken struct { CreatedAt time.Time `bun:",nullzero,notnull,default:current_timestamp"` UpdatedAt time.Time `bun:",nullzero,notnull,default:current_timestamp"` ID int64 `bun:"id,pk,autoincrement"` Token []byte `bun:"token,notnull"` SyllabusTokenID int64 `bun:"syllabus_token_id" yaml:"syllabus_token_id"` }
func AddNewToken ¶
func AddNewToken(token *MagicToken) (MagicToken, error)
func GetTokenSyllabus ¶
func GetTokenSyllabus(id int) (MagicToken, error)
type Syllabus ¶
type Syllabus struct { CreatedAt time.Time `bun:",nullzero,notnull,default:current_timestamp"` UpdatedAt time.Time `bun:",nullzero,notnull,default:current_timestamp"` ID int64 `bun:"id,pk,autoincrement"` Title string `bun:"title,notnull" form:"title" json:"title"` Description string `form:"description" json:"description"` Email string `bun:"email,notnull" form:"email" json:"email"` Attachments []*Attachment `bun:"rel:has-many,join:id=syllabus_attached_id"` ContributorID int64 `yaml:"contributor_id"` Contributor *Contributor `bun:"rel:belongs-to,join:contributor_id=id"` }
func AddNewSyllabus ¶
func GetAllSyllabi ¶
func GetSyllabus ¶
Click to show internal directories.
Click to hide internal directories.