store

package
v0.0.0-...-3d0adf2 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2019 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

====================================================

# Copyright (C)2019 All rights reserved. # # Author : domchan # Email : 814172254@qq.com # File Name : interface.go # Created : 2019/1/23 16:54 # Last Modified : 2019/1/23 16:54 # Describe : # # ====================================================

====================================================

# Copyright (C)2019 All rights reserved. # # Author : domchan # Email : 814172254@qq.com # File Name : init.go # Created : 2019/1/24 11:09 # Last Modified : 2019/1/24 11:09 # Describe : # # ====================================================

Index

Constants

This section is empty.

Variables

View Source
var (

	// ErrCornExist 已存在定时任务
	ErrCornExist = errors.New("corn: corn is existed")
)

Functions

func MustRegisterCorn

func MustRegisterCorn(n string, c Corn)

MustRegisterCorn 将定时任务注册到任务列表,如果重复注入直接panic

func RegisterCorn

func RegisterCorn(n string, c Corn) error

RegisterCorn 将定时任务注册到任务列表,如果重复注入返回错误

func Start

func Start()

Start 启动所有定时任务,此方法不会阻塞

func StartCorn

func StartCorn(c Corn) func()

StartCorn 返回定时任务的参数方法

Types

type Corn

type Corn interface {
	Name() string
	// 从缓存中读取数据,以切片的方式返回
	Read() ([][]byte, error)
	// 将数据写入数据库
	Write([][]byte) error
}

Corn 实现定时任务的读写功能

type Marshaler

type Marshaler interface {
	Marshal() ([]byte, error)
	Unmarshal([]byte) error
}

Marshaler 实现数据的序列化和反序列化

Directories

Path Synopsis
==================================================== # Copyright (C)2019 All rights reserved.
==================================================== # Copyright (C)2019 All rights reserved.

Jump to

Keyboard shortcuts

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