schapi

package module
v0.0.0-...-62b5de0 Latest Latest
Warning

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

Go to latest
Published: May 25, 2018 License: Apache-2.0 Imports: 3 Imported by: 0

README

Schapi-Go

Schapi Go는 Schapi의 Go언어 버전으로
Go언어 기반의 급식, 학사일정 파싱 라이브러리입니다.

1. 설치

schapi-go 는 GOPATH의 프로젝트에 다음과 같이 설치할 수 있습니다.

go get github.com/DSM-SchoolAPI/schapi-go

2. 예제

다음은 대덕소프트웨어마이스터고등학교 (G100000170) 의 5월 23일자 점심
식단표를 불러와 출력하는 예제입니다.

api := schapi.NewSchoolAPI(schapi.HighSchool, schapi.Daejeon, "G100000170")
fmt.Println(api.GetMonthlyMenus(2018, 5)[23].Lunch)

3. 음;

현재 작성된 Schapi-Go는 다른 언어의 Schapi와 구조도 다르고
학사일정 파싱을 구현하지 못하는 등 구현에 있어 아쉬운 부분이 많습니다.

그래서 추후 Schapi의 구조에 맞게 라이브러리 구조를 변경하고 학사일정
파싱 기능을 추가하는 마이그레이션 작업을 진행하고 있습니다!

현재 API 구조를 기존 Schapi 와 비슷하게 변경하고 학사일정 기능 추가를 고려하고 있습니다

Documentation

Index

Constants

View Source
const (
	Seoul     SchoolRegion = "stu.sen.go.kr"
	Incheon                = "stu.ice.go.kr"
	Busan                  = "stu.pen.go.kr"
	Gwangju                = "stu.gen.go.kr"
	Daejeon                = "stu.dje.go.kr"
	Daegu                  = "stu.dge.go.kr"
	Sejong                 = "stu.sje.go.kr"
	Ulsan                  = "stu.use.go.kr"
	Gyeonggi               = "stu.goe.go.kr"
	Kangwon                = "stu.kew.go.kr"
	Chungbuk               = "stu.cbe.go.kr"
	Chungnam               = "stu.cne.go.kr"
	Gyeongbuk              = "stu.gbe.go.kr"
	Gyeongnam              = "stu.gne.go.kr"
	Jeonbuk                = "stu.jbe.go.kr"
	Jeonnam                = "stu.jne.go.kr"
	Jeju                   = "stu.jje.go.kr"
)

Variables

View Source
var TIMINGS = [3]string{"조식", "중식", "석식"}
View Source
var URL = "http://%s/sts_sci_md00_001.do?schulCode=%s&schulCrseScCode=%d&schulKndScCode=0%d&schYm=%d%02d"

Functions

This section is empty.

Types

type Menu struct {
	Breakfast []string `json:"breakfast"`
	Lunch     []string `json:"lunch"`
	Dinner    []string `json:"dinner"`
}

func NewMenu

func NewMenu() *Menu

type SchoolAPI

type SchoolAPI struct {
	Kind   SchoolKind   `json:"kind"`
	Region SchoolRegion `json:"region"`
	Code   SchoolCode   `json:"code"`
}

func NewSchoolAPI

func NewSchoolAPI(kind SchoolKind, region SchoolRegion, code SchoolCode) *SchoolAPI

func (SchoolAPI) GetMenuData

func (api SchoolAPI) GetMenuData(text string) map[int][]string

func (SchoolAPI) GetMenuItem

func (api SchoolAPI) GetMenuItem(data map[int][]string) Menu

func (SchoolAPI) GetMonthlyMenuURL

func (api SchoolAPI) GetMonthlyMenuURL(year int, month int) string

func (SchoolAPI) GetMonthlyMenus

func (api SchoolAPI) GetMonthlyMenus(year int, month int) map[int]Menu

type SchoolCode

type SchoolCode string

type SchoolKind

type SchoolKind int
const (
	KinderGarten SchoolKind = 1 + iota
	ElementrySchool
	MiddleSchool
	HighSchool
)

type SchoolRegion

type SchoolRegion string

Jump to

Keyboard shortcuts

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