Documentation
¶
Index ¶
- Constants
- Variables
- func AddContent(ctx context.Context, course, lesson, index int) error
- func AddCourse(ctx context.Context, course *Course) error
- func AddLesson(ctx context.Context, lesson *Lesson) error
- func AddUser(ctx context.Context, user *User) error
- func BuyLesson(ctx context.Context, user, lesson int) error
- func CountFollowers(ctx context.Context, course int) (int, error)
- func DelContent(ctx context.Context, course, lesson int) error
- func DelCourse(ctx context.Context, id int) error
- func DelLesson(ctx context.Context, id int) error
- func DelUser(ctx context.Context, id int) error
- func Follow(ctx context.Context, user, course int) error
- func GenMime(ctx context.Context, total, count int) error
- func GetCoursesPageTotal(ctx context.Context, size int, category string) (int, error)
- func GetCoursesTotal(ctx context.Context, category string) (int, error)
- func GetLessonsPageTotal(ctx context.Context, size int, owner int) (int, error)
- func GetLessonsTotal(ctx context.Context, owner int) (int, error)
- func GetMaxIndex(ctx context.Context, course int) (int, error)
- func GetMimes(ctx context.Context, total, count int) ([]string, error)
- func GetUsersPageTotal(ctx context.Context, size int) (int, error)
- func GetUsersTotal(ctx context.Context) (int, error)
- func HashString(text string) string
- func IsBought(ctx context.Context, user, lesson int) (bool, error)
- func IsExistContent(ctx context.Context, course, lesson int) (bool, error)
- func IsFollowed(ctx context.Context, user, course int) (bool, error)
- func Mining(ctx context.Context, user int, code string) (int, error)
- func SetCourse(ctx context.Context, course *Course) error
- func SetLesson(ctx context.Context, lesson *Lesson) error
- func SetUser(ctx context.Context, user *User) error
- func SetUserTicket(ctx context.Context, user *User) error
- func UnFollow(ctx context.Context, user, course int) error
- func ValidEmail(ctx context.Context, email string) bool
- func ValidPassword(ctx context.Context, email, password string) int
- type Course
- type CourseSummary
- type Lesson
- type LessonSummary
- type User
- type UserSummary
Constants ¶
View Source
const Source string = "./fl.db"
Variables ¶
View Source
var DB *sql.DB
Functions ¶
func GetCoursesPageTotal ¶
func GetLessonsPageTotal ¶
func HashString ¶
Types ¶
type Course ¶
type Course struct {
Id int
Time int64
Title string
Introduction string
Keywords string
Image string
Category string
Owner int
Total int
Level int
}
CREATE TABLE "course" (
"id" INTEGER NOT NULL,
"time" INTEGER NOT NULL,
"title" TEXT NOT NULL,
"introduction" TEXT NOT NULL,
"keywords" TEXT NOT NULL,
"image" TEXT NOT NULL,
"category" TEXT NOT NULL,
"total" INTEGER NOT NULL DEFAULT 0,
"owner" INTEGER NOT NULL,
"level" INTEGER NOT NULL DEFAULT 0,
PRIMARY KEY("id")
);
type CourseSummary ¶
type CourseSummary struct {
Id int
Time int64
Title string
Introduction string
Image string
Level int
}
func GetCourses ¶
func GetCoursesByPage ¶
type Lesson ¶
type Lesson struct {
Id int
Time int64
Title string
Introduction string
Keywords string
Image string
Source string
Type int
Owner int
Ticket int
Level int
}
CREATE TABLE "lesson" (
"id" INTEGER NOT NULL,
"time" INTEGER NOT NULL,
"title" TEXT NOT NULL,
"introduction" TEXT NOT NULL,
"keywords" TEXT NOT NULL,
"image" TEXT NOT NULL,
"source" TEXT NOT NULL,
"type" INTEGER NOT NULL DEFAULT 0,
"owner" INTEGER NOT NULL,
"level" INTEGER NOT NULL DEFAULT 0,
PRIMARY KEY("id")
);
type LessonSummary ¶
type LessonSummary struct {
Id int
Time int64
Title string
Introduction string
Image string
Ticket int
Level int
}
func GetLessons ¶
func GetLessonsByPage ¶
type User ¶
type User struct {
Id int
Username string
Password string
Email string
Introduction string
Image string
Ticket int
Time int64
Level int
}
CREATE TABLE "user" (
"id" INTEGER NOT NULL,
"username" TEXT NOT NULL,
"password" TEXT NOT NULL,
"email" TEXT NOT NULL,
"introduction" TEXT,
"image" TEXT,
"time" INTEGER NOT NULL,
"level" INTEGER NOT NULL DEFAULT 0,
PRIMARY KEY("id")
);
Click to show internal directories.
Click to hide internal directories.