db

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2023 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type About added in v1.0.0

type About struct {
	ID      int64  `json:"id"`
	Content string `json:"content"`
}

About About

type Blog

type Blog struct {
	ID      int64     `json:"id"`
	Name    string    `json:"name"`
	Content string    `json:"content"`
	UserID  int64     `json:"userId"`
	Active  bool      `json:"active"`
	Entered time.Time `json:"entered"`
	Updated time.Time `json:"updated"`
}

Blog Blog

type BlogDB

type BlogDB interface {
	//users
	AddUser(u *User) (bool, int64)
	UpdateUser(u *User) bool
	GetUser(email string) *User
	GetUserByID(id int64) *User
	GetUserList() *[]User
	GetUnactivatedUserList() *[]User
	GetBannedUserList() *[]User
	EnableUser(uid int64) bool
	DisableUser(uid int64) bool
	DisableUserForCause(uid int64) bool
	ReinstateBannedUser(uid int64) bool

	//Role
	AddRole(name string) (bool, int64)
	GetRole(name string) *Role
	GetRoleList() *[]Role
	DeleteRole(id int64) bool

	//Blog
	AddBlog(b *Blog) (bool, int64)
	UpdateBlog(u *Blog) bool
	GetBlog(id int64) *Blog
	GetBlogsByName(name string, start int64, end int64) *[]Blog
	GetBlogList(start int64, end int64) *[]Blog
	GetActiveBlogList(start int64, end int64) *[]Blog
	ActivateBlog(id int64) bool
	DeactivateBlog(id int64) bool
	DeleteBlog(id int64) bool

	//likes
	AddLike(l *Like) bool
	RemoveLike(uid, bid int64) bool
	ViewLikes(bid int64) *[]Like

	//comments
	AddComment(b *Comment) (bool, int64)
	UpdateComment(u *Comment) bool
	GetCommentList(bid, start, end int64) *[]Comment
	ActivateComment(id int64) bool
	DeactivateComment(id int64) bool

	//user auth
	AddUserAuth(b *UserAuth) (bool, int64)
	GetUserAuthList(uid, start, end int64) *[]UserAuth

	//config
	AddConfig(b *Config) (bool, int64)
	UpdateConfig(u *Config) bool
	GetConfig() *[]Config

	//rules
	AddRule(r *Rule) (bool, int64)
	UpdateRule(r *Rule) bool
	GetRule() *[]Rule

	//Tos
	AddTos(t *Tos) (bool, int64)
	UpdateTos(t *Tos) bool
	GetTos() *[]Tos

	//About
	AddAbout(ab *About) (bool, int64)
	UpdateAbout(ab *About) bool
	GetAbout() *[]About

	//Home
	AddHome(ab *Home) (bool, int64)
	UpdateHome(ab *Home) bool
	GetHome() *[]Home

	//PrivacyPolicy
	AddPrivacyPolicy(ab *PrivacyPolicy) (bool, int64)
	UpdatePrivacyPolicy(ab *PrivacyPolicy) bool
	GetPrivacyPolicy() *[]PrivacyPolicy
}

BlogDB BlogDB

type Comment

type Comment struct {
	ID     int64  `json:"id"`
	BlogID int64  `json:"blogId"`
	UserID int64  `json:"userId"`
	Text   string `json:"text"`
	Active bool   `json:"active"`
}

Comment Comment

type Config

type Config struct {
	ID               int64 `json:"id"`
	AllowAutoPost    bool  `json:"allowAutoPost"`
	AllowAutoComment bool  `json:"allowAutoComment"`
}

Config Config

type Home added in v1.0.0

type Home struct {
	ID      int64  `json:"id"`
	Content string `json:"content"`
}

Home Home

type Like

type Like struct {
	BlogID int64 `json:"blogId"`
	UserID int64 `json:"userId"`
}

Like Like

type MyBlogDB

type MyBlogDB struct {
	DB  gdb.Database
	Log lg.Log
}

MyBlogDB MyBlogDB

func (*MyBlogDB) ActivateBlog

func (d *MyBlogDB) ActivateBlog(id int64) bool

ActivateBlog ActivateBlog

func (*MyBlogDB) ActivateComment

func (d *MyBlogDB) ActivateComment(id int64) bool

ActivateComment ActivateComment

func (*MyBlogDB) AddAbout added in v1.0.0

func (d *MyBlogDB) AddAbout(ab *About) (bool, int64)

AddAbout AddAbout

func (*MyBlogDB) AddBlog

func (d *MyBlogDB) AddBlog(b *Blog) (bool, int64)

AddBlog AddBlog

func (*MyBlogDB) AddComment

func (d *MyBlogDB) AddComment(c *Comment) (bool, int64)

AddComment AddComment

func (*MyBlogDB) AddConfig

func (d *MyBlogDB) AddConfig(c *Config) (bool, int64)

AddConfig AddConfig

func (*MyBlogDB) AddHome added in v1.0.0

func (d *MyBlogDB) AddHome(ab *Home) (bool, int64)

AddHome AddHome

func (*MyBlogDB) AddLike

func (d *MyBlogDB) AddLike(l *Like) bool

AddLike AddLike

func (*MyBlogDB) AddPrivacyPolicy added in v1.0.0

func (d *MyBlogDB) AddPrivacyPolicy(ab *PrivacyPolicy) (bool, int64)

AddPrivacyPolicy AddPrivacyPolicy

func (*MyBlogDB) AddRole

func (d *MyBlogDB) AddRole(name string) (bool, int64)

AddRole AddRole

func (*MyBlogDB) AddRule added in v1.0.0

func (d *MyBlogDB) AddRule(r *Rule) (bool, int64)

AddRule AddRule

func (*MyBlogDB) AddTos added in v1.0.0

func (d *MyBlogDB) AddTos(t *Tos) (bool, int64)

AddTos AddTos

func (*MyBlogDB) AddUser

func (d *MyBlogDB) AddUser(u *User) (bool, int64)

AddUser AddUser

func (*MyBlogDB) AddUserAuth

func (d *MyBlogDB) AddUserAuth(c *UserAuth) (bool, int64)

AddUserAuth AddUserAuth

func (*MyBlogDB) DeactivateBlog

func (d *MyBlogDB) DeactivateBlog(id int64) bool

DeactivateBlog DeactivateBlog

func (*MyBlogDB) DeactivateComment

func (d *MyBlogDB) DeactivateComment(id int64) bool

DeactivateComment DeactivateComment

func (*MyBlogDB) DeleteBlog

func (d *MyBlogDB) DeleteBlog(id int64) bool

DeleteBlog DeleteBlog

func (*MyBlogDB) DeleteRole

func (d *MyBlogDB) DeleteRole(id int64) bool

DeleteRole DeleteRole

func (*MyBlogDB) DisableUser

func (d *MyBlogDB) DisableUser(uid int64) bool

DisableUser DisableUser

func (*MyBlogDB) DisableUserForCause

func (d *MyBlogDB) DisableUserForCause(uid int64) bool

DisableUserForCause DisableUserForCause

func (*MyBlogDB) EnableUser

func (d *MyBlogDB) EnableUser(uid int64) bool

EnableUser EnableUser

func (*MyBlogDB) GetAbout added in v1.0.0

func (d *MyBlogDB) GetAbout() *[]About

GetAbout GetAbout

func (*MyBlogDB) GetActiveBlogList

func (d *MyBlogDB) GetActiveBlogList(start int64, end int64) *[]Blog

GetActiveBlogList GetActiveBlogList

func (*MyBlogDB) GetBannedUserList

func (d *MyBlogDB) GetBannedUserList() *[]User

GetBannedUserList GetBannedUserList

func (*MyBlogDB) GetBlog

func (d *MyBlogDB) GetBlog(id int64) *Blog

GetBlog GetBlog

func (*MyBlogDB) GetBlogList

func (d *MyBlogDB) GetBlogList(start int64, end int64) *[]Blog

GetBlogList GetBlogList

func (*MyBlogDB) GetBlogsByName

func (d *MyBlogDB) GetBlogsByName(name string, start int64, end int64) *[]Blog

GetBlogsByName GetBlogsByName

func (*MyBlogDB) GetCommentList

func (d *MyBlogDB) GetCommentList(bid, start, end int64) *[]Comment

GetCommentList GetCommentList

func (*MyBlogDB) GetConfig

func (d *MyBlogDB) GetConfig() *[]Config

GetConfig GetConfig

func (*MyBlogDB) GetHome added in v1.0.0

func (d *MyBlogDB) GetHome() *[]Home

GetHome GetHome

func (*MyBlogDB) GetPrivacyPolicy added in v1.0.0

func (d *MyBlogDB) GetPrivacyPolicy() *[]PrivacyPolicy

GetPrivacyPolicy GetPrivacyPolicy

func (*MyBlogDB) GetRole

func (d *MyBlogDB) GetRole(name string) *Role

GetRole GetRole

func (*MyBlogDB) GetRoleList

func (d *MyBlogDB) GetRoleList() *[]Role

GetRoleList GetRoleList

func (*MyBlogDB) GetRule added in v1.0.0

func (d *MyBlogDB) GetRule() *[]Rule

GetRule GetRule

func (*MyBlogDB) GetTos added in v1.0.0

func (d *MyBlogDB) GetTos() *[]Tos

GetTos GetTos

func (*MyBlogDB) GetUnactivatedUserList

func (d *MyBlogDB) GetUnactivatedUserList() *[]User

GetUnactivatedUserList GetUnactivatedUserList

func (*MyBlogDB) GetUser

func (d *MyBlogDB) GetUser(email string) *User

GetUser GetUser

func (*MyBlogDB) GetUserAuthList

func (d *MyBlogDB) GetUserAuthList(uid, start, end int64) *[]UserAuth

GetUserAuthList GetUserAuthList

func (*MyBlogDB) GetUserByID

func (d *MyBlogDB) GetUserByID(id int64) *User

GetUserByID GetUserById

func (*MyBlogDB) GetUserList

func (d *MyBlogDB) GetUserList() *[]User

GetUserList GetUserList

func (*MyBlogDB) New

func (d *MyBlogDB) New() BlogDB

New New

func (*MyBlogDB) ReinstateBannedUser

func (d *MyBlogDB) ReinstateBannedUser(uid int64) bool

ReinstateBannedUser ReinstateBannedUser

func (*MyBlogDB) RemoveLike

func (d *MyBlogDB) RemoveLike(uid, bid int64) bool

RemoveLike RemoveLike

func (*MyBlogDB) UpdateAbout added in v1.0.0

func (d *MyBlogDB) UpdateAbout(ab *About) bool

UpdateAbout UpdateAbout

func (*MyBlogDB) UpdateBlog

func (d *MyBlogDB) UpdateBlog(b *Blog) bool

UpdateBlog UpdateBlog

func (*MyBlogDB) UpdateComment

func (d *MyBlogDB) UpdateComment(c *Comment) bool

UpdateComment UpdateComment

func (*MyBlogDB) UpdateConfig

func (d *MyBlogDB) UpdateConfig(c *Config) bool

UpdateConfig UpdateConfig

func (*MyBlogDB) UpdateHome added in v1.0.0

func (d *MyBlogDB) UpdateHome(ab *Home) bool

UpdateHome UpdateHome

func (*MyBlogDB) UpdatePrivacyPolicy added in v1.0.0

func (d *MyBlogDB) UpdatePrivacyPolicy(ab *PrivacyPolicy) bool

UpdatePrivacyPolicy UpdatePrivacyPolicy

func (*MyBlogDB) UpdateRule added in v1.0.0

func (d *MyBlogDB) UpdateRule(r *Rule) bool

UpdateRule UpdateRule

func (*MyBlogDB) UpdateTos added in v1.0.0

func (d *MyBlogDB) UpdateTos(t *Tos) bool

UpdateTos UpdateTos

func (*MyBlogDB) UpdateUser

func (d *MyBlogDB) UpdateUser(u *User) bool

UpdateUser UpdateUser

func (*MyBlogDB) ViewLikes

func (d *MyBlogDB) ViewLikes(bid int64) *[]Like

ViewLikes ViewLikes

type PrivacyPolicy added in v1.0.0

type PrivacyPolicy struct {
	ID      int64  `json:"id"`
	Content string `json:"content"`
}

PrivacyPolicy Privacy

type Role

type Role struct {
	ID   int64  `json:"id"`
	Name string `json:"name"`
}

Role Role

type Rule added in v1.0.0

type Rule struct {
	ID      int64  `json:"id"`
	Content string `json:"content"`
}

Rule Rule

type Tos added in v1.0.0

type Tos struct {
	ID      int64  `json:"id"`
	Content string `json:"content"`
}

Tos Tos

type User

type User struct {
	ID               int64  `json:"id"`
	Email            string `json:"email"`
	Password         string `json:"password"`
	FirstName        string `json:"firstName"`
	LastName         string `json:"lastName"`
	Image            []byte `json:"image"`
	RoleID           int64  `json:"roleId"`
	Active           bool   `json:"active"`
	DisabledForCause bool   `json:"disabledForCause"`
}

User User

type UserAuth

type UserAuth struct {
	ID       int64     `json:"id"`
	AuthType string    `json:"type"`
	UserID   int64     `json:"userId"`
	Entered  time.Time `json:"entered"`
}

UserAuth UserAuth

Jump to

Keyboard shortcuts

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