model

package
v0.0.0-...-f26ce0e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 15, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateAnswer

func CreateAnswer(a *Answer)

回答 を作成

func CreateAnswerComment

func CreateAnswerComment(a *AnswerComment)

作成

func CreateAnswerGood

func CreateAnswerGood(g *AnswerGood)

func CreateBookMark

func CreateBookMark(b *BookMark)

func CreateNotification

func CreateNotification(n *Notification)

Notification を 1 つ作成

func CreateQuestion

func CreateQuestion(q *Question)

question を作成

func CreateQuestionComment

func CreateQuestionComment(q *QuestionComment)

作成

func CreateQuestionGood

func CreateQuestionGood(g *QuestionGood)

good を 1 つ作成

func CreateUser

func CreateUser(user *User)

func DeleteAnswer

func DeleteAnswer(a *Answer) error

answer を 1 つ削除

func DeleteAnswerComment

func DeleteAnswerComment(a *AnswerComment) error

一つ削除

func DeleteAnswerGood

func DeleteAnswerGood(g *AnswerGood) error

good を複数削除

func DeleteBookMark

func DeleteBookMark(b *BookMark) error

good を 1 つ削除

func DeleteNotification

func DeleteNotification(n *Notification) error

Notification を一つ削除

func DeleteQuestion

func DeleteQuestion(q *Question) error

question を 1 つ削除

func DeleteQuestionComment

func DeleteQuestionComment(q *QuestionComment) error

一つ削除

func DeleteQuestionGood

func DeleteQuestionGood(g *QuestionGood) error

good を 1 つ削除

func DeleteUser

func DeleteUser(u *User) error

user を 1 つ削除

func UpdateAnswer

func UpdateAnswer(a *Answer) error

answer を UPDATE

func UpdateAnswerComment

func UpdateAnswerComment(a *AnswerComment) error

更新

func UpdateNotification

func UpdateNotification(n *Notification) error

notification を UPDATE 通知に関して,変更するのは既読フラグだけなのでこれでいい

func UpdateQuestion

func UpdateQuestion(q *Question) error

question を UPDATE

func UpdateQuestionComment

func UpdateQuestionComment(q *QuestionComment) error

更新

func UpdateUser

func UpdateUser(u *User) error

user を UPDATE

Types

type Answer

type Answer struct {
	ID  int `json:"id" gorm:"praimary_key"` // Id (インクリメント)
	UID int `json:"uid"`                    // User Id
	QID int `json:"qid"`                    // Question Id (質問に紐ずける)

	// 以下, 回答の構成要素たち
	Body          string `json:"body"`
	Date          string `json:"date"`
	FavoriteCount int    `json:"favoriteCount"`
}

回答テーブル

type AnswerComment

type AnswerComment struct {
	ID  int `json:"id" gorm:"praimary_key"`
	UID int `json:"uid"`
	AID int `json:"aid"`

	Body string `json:"body"`
	Date string `json:"date"`
}

type AnswerComments

type AnswerComments []AnswerComment

func FindAnswerComments

func FindAnswerComments(a *AnswerComment) AnswerComments

複数取得

type AnswerGood

type AnswerGood struct {
	ID  int `json:"id" gorm:"praimary_key"`
	UID int `json:"uid"`
	AID int `json:"aid"`
}

type AnswerGoods

type AnswerGoods []AnswerGood

func FindAnswerGoods

func FindAnswerGoods(g *AnswerGood) AnswerGoods

いいねを取得 例えば, UID AID 指定で,存在するかを判定できそう

type Answers

type Answers []Answer

Question の配列として定義

func FindAnswers

func FindAnswers(a *Answer, orderMode string) Answers

おそらくだけども, 引数はわりと自由 例えば, {QID: 3} を渡すと, Question に紐ずいた検索ができそう

func FindAnswersWithPage

func FindAnswersWithPage(a *Answer, page int, length int) Answers

条件を満たす「質問」を, 固定長取得する page := ページ番号( 1-indexed ), length := 1 ページあたりのアイテム数

type BookMark

type BookMark struct {
	ID  int `json:"id" gorm:"praimary_key"`
	UID int `json:"uid"`
	QID int `json:"qid"`
}

type BookMarks

type BookMarks []BookMark

func FindBookMarks

func FindBookMarks(b *BookMark) BookMarks

いいねを取得 例えば, UID QID 指定で,存在するかを判定できそう

type Notification

type Notification struct {
	ID      int    `json:"id" gorm:"praimary_key"`
	UID     int    `json:"uid"`  // 通知される人
	OUID    int    `json:"ouid"` // 関与した人
	QID     int    `json:"qid"`
	Type    int    `json:"type"`
	Watched bool   `json:"watched"`
	Body    string `json:"body"`
}

type Notifications

type Notifications []Notification

func FindNotifications

func FindNotifications(n *Notification) Notifications

Notification の配列を取得

type Question

type Question struct {
	UID int `json:"uid"`                    // User Id
	TID int `json:"tid"`                    // Tag Id
	ID  int `json:"id" gorm:"praimary_key"` // Id (インクリメント)

	// 以下, 質問の構成要素たち
	Title string `json:"title"`
	Body  string `json:"body"`
	Url   string `json:"url"`
	Date  string `json:"date"`

	Completed     bool `json:"completed"`
	AnswerCount   int  `json:"answerCount"`
	FavoriteCount int  `json:"favoriteCount"`
	BrowseCount   int  `json:"browseCount"`
}

質問テーブル

type QuestionComment

type QuestionComment struct {
	ID  int `json:"id" gorm:"praimary_key"`
	UID int `json:"uid"`
	QID int `json:"qid"`

	Body string `json:"body"`
	Date string `json:"date"`
}

type QuestionComments

type QuestionComments []QuestionComment

func FindQuestionComments

func FindQuestionComments(q *QuestionComment) QuestionComments

複数取得

type QuestionGood

type QuestionGood struct {
	ID  int `json:"id" gorm:"praimary_key"`
	UID int `json:"uid"` //  いいねをした人
	QID int `json:"qid"`
}

type QuestionGoods

type QuestionGoods []QuestionGood

func FindQuestionGoods

func FindQuestionGoods(g *QuestionGood) QuestionGoods

いいねを取得 例えば, UID QID 指定で,存在するかを判定できそう

type Questions

type Questions []Question

Question の配列として定義

func FindQuestions

func FindQuestions(q *Question) Questions

おそらくだけども, 引数はわりと自由 例えば, {UID: 3} を渡すと, 絞り込みで取得ができるっぽい

func FindQuestionsWithPage

func FindQuestionsWithPage(q *Question, page int, length int, orderMode string) Questions

条件を満たす「質問」を, 固定長取得する page := ページ番号( 1-indexed ), length := 1 ページあたりのアイテム数

type ReturnUser

type ReturnUser struct {
	ID               int    `json:"id" gorm:"praimary_key"`
	Name             string `json:"name"`
	TwitterId        string `json:"twitter_id"`
	FavoriteAnswer   int    `json:"favorite_answer"`
	FavoriteQuestion int    `json:"favorite_question"`
	FavoriteSum      int    `json:"favorite_sum"`

	NotificationFlag bool `json:"notification_flag"`
}

パスワードは json として送る必要がない

type ReturnUsers

type ReturnUsers []ReturnUser

type User

type User struct {
	ID               int    `json:"id" gorm:"praimary_key"`
	Name             string `json:"name"`
	Password         string `json:"password"`
	TwitterId        string `json:"twitter_id"`
	FavoriteAnswer   int    `json:"favorite_answer"`
	FavoriteQuestion int    `json:"favorite_question"`
	FavoriteSum      int    `json:"favorite_sum"`

	NotificationFlag bool `json:"notification_flag"`
}

func FindUser

func FindUser(u *User) User

func (User) IntoReturnUser

func (u User) IntoReturnUser() ReturnUser

type Users

type Users []User

User の配列として定義

func FindUsers

func FindUsers(u *User) Users

func FindUsersWithPage

func FindUsersWithPage(u *User, page int, length int, orderMode string) Users

条件を満たす「質問」を, 固定長取得する page := ページ番号( 1-indexed ), length := 1 ページあたりのアイテム数

func (Users) IntoReturnUsers

func (users Users) IntoReturnUsers() ReturnUsers

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL