database

package
v0.0.0-...-905b784 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2020 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Connect

func Connect() *gorm.DB

Connect DB랑 연결함

func DBInit

func DBInit()

DBInit 데이터베이스 초기화

Types

type ClientInfo

type ClientInfo struct {
	ID        int    `gorm:"PRIMARY_KEY;unique_index;AUTO_INCREMENT"`
	ClientID  string `gorm:"PRIMARY_KEY;unique_index"`
	ClientPW  string `gorm:"size:255"`
	Link      string `gorm:"size:255"`
	Token     string `gorm:"size:255"`
	Valid     bool
	CreatedAt time.Time
	UpdatedAt time.Time
}

ClientInfo 클라이언트정보 DB schema

type EventType

type EventType int

EventType 발생가능한 이벤트 타입

const (
	UNKOWN    EventType = -1
	CREATED   EventType = 100
	UPDATED   EventType = 101
	DELETED   EventType = 102
	LOGIN     EventType = 200
	LOGOUT    EventType = 201
	LOGINFAIL EventType = 202
	QUERYLOG  EventType = 300
)

사용자 종류

type Log

type Log struct {
	ID        int64     `gorm:"AUTO_INCREMENT;PRIMARY_KEY"`
	User      int       `gorm:"index:user"`
	Client    int       `gorm:"index:client"`
	Event     EventType `gorm:"index:event"`
	Message   string
	CreatedAt time.Time
}

Log 이벤트발생시 기록남기는 DB schema

type UserInfo

type UserInfo struct {
	ID         int    `gorm:"PRIMARY_KEY;unique_index;AUTO_INCREMENT"`
	UserName   string `gorm:"index:userName"`
	UserNumber int    `gorm:"index:userNumber"`
	UserEmail  string
	UserID     string `gorm:"unique_index"`
	UserPW     string
	CreatedAt  time.Time
	UpdatedAt  time.Time
}

UserInfo 사용자정보 DB schema

type UserType

type UserType int8

UserType 사용자 타입

const (
	ADMINISTRATOR UserType = -1
	STUDENT       UserType = iota
	PROFESSOR
	INSTRUCTOR
	EXTERNAL
)

사용자 종류

Jump to

Keyboard shortcuts

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