Documentation ¶
Index ¶
- type AccountID
- type LightMongoAccountStruct
- type MongoAccountHelper
- func (h *MongoAccountHelper) CreateAccount(accountID AccountID, displayID string, password string, mail string, ...) (*MongoAccountStruct, error)
- func (h *MongoAccountHelper) DeleteAccount(accountID AccountID, deleteMethod int32) error
- func (h *MongoAccountHelper) FindAccount(accountID AccountID) (*MongoAccountStruct, error)
- func (h *MongoAccountHelper) ToMongo(ac gen.AccountStruct) MongoAccountStruct
- func (h *MongoAccountHelper) UpdateAccount(accountID AccountID, newStruct MongoAccountStruct) error
- func (h *MongoAccountHelper) UpdateInvite(accountID AccountID, code string, invitedCount int32) error
- type MongoAccountStruct
- func (f *MongoAccountStruct) ToOpenApi(md *mongo.Client) (ac *gen.AccountStruct)
- func (f *MongoAccountStruct) UpdateAccess(access gen.AccountStructAccess)
- func (f *MongoAccountStruct) UpdateApiSeq(update int32)
- func (f *MongoAccountStruct) UpdateDescription(description string)
- func (f *MongoAccountStruct) UpdateDisplayID(col *mongo.Collection, displayID string) (err error)
- func (f *MongoAccountStruct) UpdateFavorite(favorite int32)
- func (f *MongoAccountStruct) UpdateIpfs(ipfs gen.AccountStructIpfs)
- func (f *MongoAccountStruct) UpdateMail(mail string)
- func (f *MongoAccountStruct) UpdateName(col *mongo.Collection, name string) (err error)
- func (f *MongoAccountStruct) UpdatePassword(oldPassword string, newPassword string) (err error)
- func (f *MongoAccountStruct) UpdatePermission(permission int32)
- func (f *MongoAccountStruct) ValidatePassword(password string) (err error)
- type MongoAccountStructAccess
- type MongoAccountStructInvite
- type MongoAccountStructIpfs
- type MongoAccountStructNotify
- type MongoInvite
- type MongoInviteHelper
- type MongoLightArtStruct
- type MongoMuteHelper
- func (h *MongoMuteHelper) CreateMute(muteID int32, accountID AccountID, targetType string, targetID int32) (*MongoMuteStruct, error)
- func (h *MongoMuteHelper) DeleteMute(muteID int32, accountID AccountID) error
- func (h *MongoMuteHelper) FindDuplicatedMute(targetType string, targetID int32, accountID AccountID) error
- func (h *MongoMuteHelper) FindMute(muteID int32) (*MongoMuteStruct, error)
- func (h *MongoMuteHelper) ToMongo(mt gen.MuteStruct) *MongoMuteStruct
- type MongoMuteStruct
- type MongoMylistHelper
- func (h *MongoMylistHelper) CreateMylist(MylistID int32, targetType string, targetID int32) (*MongoMylistStruct, error)
- func (h *MongoMylistHelper) DeleteMylist(MylistID int32) error
- func (h *MongoMylistHelper) FindMylist(MylistID int32) (*MongoMylistStruct, error)
- func (h *MongoMylistHelper) FindMylistUsingFilter(filter bson.M) (*MongoMylistStruct, error)
- type MongoMylistStruct
- type MongoSequence
- type MongoSequenceHelper
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LightMongoAccountStruct ¶
type LightMongoAccountStruct struct { // アカウントID AccountID AccountID `bson:"accountID,omitempty"` // アカウント名 Name string `bson:"name,omitempty"` }
LightMongoAccountStruct - 簡易アカウント型(読み取り専用)
type MongoAccountHelper ¶
type MongoAccountHelper struct {
// contains filtered or unexported fields
}
MongoAccountHelper is helper struct requires *mongo.Collection
func NewMongoAccountHelper ¶
func NewMongoAccountHelper(md *mongo.Client) MongoAccountHelper
NewMongoAccountHelper creates a helper for handle account endpoints
func (*MongoAccountHelper) CreateAccount ¶
func (h *MongoAccountHelper) CreateAccount( accountID AccountID, displayID string, password string, mail string, name string, inviterID AccountID, inviteCode string, ) (*MongoAccountStruct, error)
CreateAccount creates new mongo account instance
func (*MongoAccountHelper) DeleteAccount ¶
func (h *MongoAccountHelper) DeleteAccount(accountID AccountID, deleteMethod int32) error
DeleteAccount set delete flag to specified account
func (*MongoAccountHelper) FindAccount ¶
func (h *MongoAccountHelper) FindAccount(accountID AccountID) (*MongoAccountStruct, error)
FindAccount finds specified account from database
func (*MongoAccountHelper) ToMongo ¶
func (h *MongoAccountHelper) ToMongo(ac gen.AccountStruct) MongoAccountStruct
ToMongo converts specified openapi struct to mongo struct
func (*MongoAccountHelper) UpdateAccount ¶
func (h *MongoAccountHelper) UpdateAccount(accountID AccountID, newStruct MongoAccountStruct) error
UpdateAccount updates specified account with using specified instance
func (*MongoAccountHelper) UpdateInvite ¶
func (h *MongoAccountHelper) UpdateInvite(accountID AccountID, code string, invitedCount int32) error
UpdateInvite updates specified account's invite info
type MongoAccountStruct ¶
type MongoAccountStruct struct { // MongoのユニークID ID primitive.ObjectID `bson:"_id,omitempty"` // アカウント状態 0:通常 1:ユーザー削除 2:管理者削除 AccountStatus int32 `bson:"accountStatus,omitempty" validate:"omitempty,gte=0,lte=2"` // ユーザーID AccountID AccountID `json:"accountID,omitempty" bson:"accountID,omitempty" validate:"omitempty,gte=0"` // (Twitterのような)表示IDを指定します。ここで指定したIDがログインに使用されます。英数字のみ入力できます。 DisplayID string `bson:"displayID,omitempty" validate:"omitempty,alphanum,min=3,max=20"` // APIキー ApiKey string `bson:"apiKey,omitempty" validate:"omitempty,min=0,max=500"` // 長期間有効トークン検証用シーケンス ApiSeq int32 `bson:"apiSeq,omitempty" validate:"omitempty,gte=0"` // 権限レベル 0:普通 5:Modelator 9:SysOp Permission int32 `bson:"permission,omitempty" validate:"omitempty,gte=0,lte=9"` // 新しいパスワードを入力します Password string `bson:"password,omitempty" validate:"omitempty,alphanum,min=6,max=100"` // ユーザーのメールアドレス(連絡用) Mail string `bson:"mail,omitempty" validate:"omitempty,email,max=80"` // TOTP認証用パスワード TotpCode string `bson:"totpCode,omitempty"` // TOTPが有効かが入ります TotpEnabled bool `bson:"totpEnabled,omitempty"` // 他のユーザーに表示されるユーザー名/投稿者名 Name string `bson:"name,omitempty" validate:"omitempty,alphanumunicode,min=1,max=20"` // 他のユーザーに表示されるユーザー説明文/投稿者説明 Description string `bson:"description,omitempty" validate:"omitempty,alphanumunicode,min=0,max=1000"` // ユーザーの推しキャラ(タグID)を選択します Favorite int32 `bson:"favorite,omitempty" validate:"omitempty,gte=0"` Access MongoAccountStructAccess `bson:"access,omitempty"` Inviter LightMongoAccountStruct `bson:"inviter,omitempty"` Invite MongoAccountStructInvite `bson:"invite,omitempty"` Notify MongoAccountStructNotify `bson:"notify,omitempty"` Ipfs MongoAccountStructIpfs `bson:"ipfs,omitempty"` }
MongoAccountStruct - アカウントの取得/編集に使うリクエスト
func (*MongoAccountStruct) ToOpenApi ¶
func (f *MongoAccountStruct) ToOpenApi(md *mongo.Client) (ac *gen.AccountStruct)
ToOpenApi converts this struct to openapi struct
func (*MongoAccountStruct) UpdateAccess ¶
func (f *MongoAccountStruct) UpdateAccess(access gen.AccountStructAccess)
UpdateAccess updates access if new access is not empty
func (*MongoAccountStruct) UpdateApiSeq ¶
func (f *MongoAccountStruct) UpdateApiSeq(update int32)
UpdateApiSeq increase ApiSeq if apiSeq is not empty
func (*MongoAccountStruct) UpdateDescription ¶
func (f *MongoAccountStruct) UpdateDescription(description string)
UpdateDescription updates description if new description is not empty
func (*MongoAccountStruct) UpdateDisplayID ¶
func (f *MongoAccountStruct) UpdateDisplayID(col *mongo.Collection, displayID string) (err error)
UpdateDisplayID updates displayID of instance with validate conflict
func (*MongoAccountStruct) UpdateFavorite ¶
func (f *MongoAccountStruct) UpdateFavorite(favorite int32)
UpdateFavorite updates favorite if new favorite is not empty
func (*MongoAccountStruct) UpdateIpfs ¶
func (f *MongoAccountStruct) UpdateIpfs(ipfs gen.AccountStructIpfs)
UpdateIpfs updates ipfs if new ipfs is not empty
func (*MongoAccountStruct) UpdateMail ¶
func (f *MongoAccountStruct) UpdateMail(mail string)
UpdateMail updates mail if new mail is not empty
func (*MongoAccountStruct) UpdateName ¶
func (f *MongoAccountStruct) UpdateName(col *mongo.Collection, name string) (err error)
UpdateName updates name of instance with validate conflict
func (*MongoAccountStruct) UpdatePassword ¶
func (f *MongoAccountStruct) UpdatePassword(oldPassword string, newPassword string) (err error)
UpdatePassword updates password with validate password
func (*MongoAccountStruct) UpdatePermission ¶
func (f *MongoAccountStruct) UpdatePermission(permission int32)
UpdatePermission updates permission if new permission is not empty
func (*MongoAccountStruct) ValidatePassword ¶
func (f *MongoAccountStruct) ValidatePassword(password string) (err error)
ValidatePassword validates specified password matches to this instance
type MongoAccountStructAccess ¶
type MongoAccountStructAccess struct { // 投稿を承認できるか CanApprovePost bool `bson:"canApprovePost,omitempty"` // コメントできるか CanComment bool `bson:"canComment,omitempty"` // 投稿できるか CanCreatePost bool `bson:"canCreatePost,omitempty"` // 投稿を編集できるか CanEditPost bool `bson:"canEditPost,omitempty"` // 招待できるか CanInvite bool `bson:"canInvite,omitempty"` // いいねできるか CanLike bool `bson:"canLike,omitempty"` }
MongoAccountStructAccess - 管理者権限とは別の細かな権限
type MongoAccountStructInvite ¶
type MongoAccountStructInvite struct { // 招待コード(shortuuid) Code string `bson:"code,omitempty" validate:"omitempty,alphanum,min=4,max=12"` // 招待通し番号 InviteID int32 `bson:"inviteID,omitempty" validate:"omitempty,gte=0"` // 招待した人数の累計(誰を招待したかは表示されない) InvitedCount int32 `bson:"invitedCount,omitempty" validate:"omitempty,gte=0"` }
MongoAccountStructInvite - 招待情報
type MongoAccountStructIpfs ¶
type MongoAccountStructIpfs struct { // IPFSゲートウェイを使用するか否か GatewayEnabled bool `bson:"gatewayEnabled,omitempty"` // 使用する任意のゲートウェイアドレス GatewayUrl string `bson:"gatewayUrl,omitempty" validate:"omitempty,url,max=100"` // IPFSノードを使用するか否か NodeEnabled bool `bson:"nodeEnabled,omitempty"` // 使用する任意のノードアドレス NodeUrl string `bson:"nodeUrl,omitempty" validate:"omitempty,url,max=100"` // マイリストを自動Pinningするか PinEnabled bool `bson:"pinEnabled,omitempty"` }
MongoAccountStructIpfs - IPFS設定
type MongoAccountStructNotify ¶
type MongoAccountStructNotify struct { HasLineNotify bool `bson:"hasLineNotify,omitempty"` HasWebNotify bool `bson:"hasWebNotify,omitempty"` }
MongoAccountStructNotify - 通知クライアントを設定済みか
type MongoInvite ¶
type MongoInvite struct { // MongoのユニークID ID primitive.ObjectID `json:"_id,omitempty" bson:"_id,omitempty"` // 招待の発行者ID Inviter AccountID `json:"inviter" bson:"inviter" validate:"gte=0"` // 招待の利用者ID Invitee AccountID `json:"invitee" bson:"invitee" validate:"gte=0"` // 招待コード Code string `json:"code" bson:"code" validate:"alphanum,min=4,max=12"` }
MongoInvite - 招待コード情報
type MongoInviteHelper ¶
type MongoInviteHelper struct {
// contains filtered or unexported fields
}
MongoInviteHelper is helper struct requires *mongo.Collection
func NewMongoInviteHelper ¶
func NewMongoInviteHelper(md *mongo.Client) MongoInviteHelper
NewMongoInviteHelper creates a helper for handle account endpoints
func (*MongoInviteHelper) CreateInvite ¶
func (h *MongoInviteHelper) CreateInvite(code string, inviter AccountID) error
CreateInvite inserts specified code to database
func (*MongoInviteHelper) FindInvite ¶
func (h *MongoInviteHelper) FindInvite(code string) (*MongoInvite, error)
FindInvite finds specified invite info from database
type MongoLightArtStruct ¶
type MongoLightArtStruct struct { // イラストID ArtID int32 `json:"artID,omitempty" validate:"gte=0"` }
MongoLightArtStruct - 簡易イラスト情報(読み取り専用)
type MongoMuteHelper ¶
type MongoMuteHelper struct {
// contains filtered or unexported fields
}
MongoMuteHelper is helper struct requires *mongo.Collection
func NewMongoMuteHelper ¶
func NewMongoMuteHelper(md *mongo.Client) MongoMuteHelper
NewMongoMuteHelper creates a helper for handle mutes endpoints
func (*MongoMuteHelper) CreateMute ¶
func (h *MongoMuteHelper) CreateMute(muteID int32, accountID AccountID, targetType string, targetID int32) (*MongoMuteStruct, error)
CreateMute inserts specified mute to database
func (*MongoMuteHelper) DeleteMute ¶
func (h *MongoMuteHelper) DeleteMute(muteID int32, accountID AccountID) error
DeleteMute deletes specified mute from database
func (*MongoMuteHelper) FindDuplicatedMute ¶
func (h *MongoMuteHelper) FindDuplicatedMute(targetType string, targetID int32, accountID AccountID) error
FindDuplicatedMute finds specified duplicated mute from database
func (*MongoMuteHelper) FindMute ¶
func (h *MongoMuteHelper) FindMute(muteID int32) (*MongoMuteStruct, error)
FindMute finds specified mute from database
func (*MongoMuteHelper) ToMongo ¶
func (h *MongoMuteHelper) ToMongo(mt gen.MuteStruct) *MongoMuteStruct
ToMongo converts specified openapi struct to mongo struct
type MongoMuteStruct ¶
type MongoMuteStruct struct { // MongoのユニークID ID primitive.ObjectID `json:"_id,omitempty" bson:"_id,omitempty"` // ユーザーID AccountID AccountID `json:"accountID,omitempty" bson:"accountID,omitempty" validate:"gte=0"` // ミュートID MuteID int32 `bson:"muteID,omitempty" validate:"gte=0"` // ミュート種別 TargetType string `bson:"targetType,omitempty" validate:"gte=0,lte=9"` // 対象のタグ/絵師ID TargetID int32 `bson:"targetID,omitempty" validate:"gte=0"` }
MongoMuteStruct - ミュート情報
func (*MongoMuteStruct) ToOpenApi ¶
func (f *MongoMuteStruct) ToOpenApi() *gen.MuteStruct
ToOpenApi converts this struct to openapi struct
type MongoMylistHelper ¶
type MongoMylistHelper struct {
// contains filtered or unexported fields
}
MongoMylistHelper is helper struct requires *mongo.Collection
func NewMongoMylistHelper ¶
func NewMongoMylistHelper(md *mongo.Client) MongoMylistHelper
NewMongoMylistHelper creates a helper for handle mylists endpoints
func (*MongoMylistHelper) CreateMylist ¶
func (h *MongoMylistHelper) CreateMylist(MylistID int32, targetType string, targetID int32) (*MongoMylistStruct, error)
CreateMylist inserts specified mylist to database
func (*MongoMylistHelper) DeleteMylist ¶
func (h *MongoMylistHelper) DeleteMylist(MylistID int32) error
DeleteMylist deletes specified mylist from database
func (*MongoMylistHelper) FindMylist ¶
func (h *MongoMylistHelper) FindMylist(MylistID int32) (*MongoMylistStruct, error)
FindMylist finds specified mylist from database
func (*MongoMylistHelper) FindMylistUsingFilter ¶
func (h *MongoMylistHelper) FindMylistUsingFilter(filter bson.M) (*MongoMylistStruct, error)
FindMylistUsingFilter finds specified mylist from database
type MongoMylistStruct ¶
type MongoMylistStruct struct { // マイリストID MylistID int32 `json:"mylistID,omitempty"` // マイリスト名 Name string `json:"name,omitempty" validate:"omitempty,alphanumunicode,min=1,max=50"` // マイリスト説明文 Description string `json:"description,omitempty" validate:"omitempty,alphanumunicode,min=1,max=50"` // マイリスト作成日時 CreatedDate time.Time `json:"createdDate,omitempty"` // マイリスト更新日時 UpdatedDate time.Time `json:"updatedDate,omitempty"` // 公開/非公開 Private bool `json:"private,omitempty"` // イラストID一覧 Arts []MongoLightArtStruct `json:"arts,omitempty"` // マイリスト所有者の簡易アカウント情報 Owner LightMongoAccountStruct `json:"owner,omitempty"` }
MongoMylistStruct - マイリスト情報
type MongoSequence ¶
type MongoSequence struct { // MongoのユニークID ID primitive.ObjectID `json:"_id,omitempty" bson:"_id,omitempty"` // シーケンスのキー Key string `json:"key" bson:"key" validate:"alphanum,min=1,max=32"` // シーケンスの現在値 Value int32 `json:"value" bson:"value" validate:"gte=0"` }
MongoSequence - 連番保管情報
type MongoSequenceHelper ¶
type MongoSequenceHelper struct {
// contains filtered or unexported fields
}
MongoSequenceHelper is helper struct for handle sequence
func NewMongoSequenceHelper ¶
func NewMongoSequenceHelper(md *mongo.Client, dbName string, seqName string) MongoSequenceHelper
NewMongoSequenceHelper creates a helper for handle get and update sequence
func (*MongoSequenceHelper) GetSeq ¶
func (m *MongoSequenceHelper) GetSeq() (resp int32, err error)
GetSeq gets the latest - 1 sequence number from database
func (*MongoSequenceHelper) UpdateSeq ¶
func (m *MongoSequenceHelper) UpdateSeq() (err error)
UpdateSeq increases sequence number of database