Version: v3.1.0-rc.1+incompatible Latest Latest

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

Go to latest
Published: Sep 18, 2018 License: MIT Imports: 9 Imported by: 0




View Source
const SystemTypeVersion = "version"


This section is empty.


func RegistUpgrader

func RegistUpgrader(version string, handlerFunc func(storage.DI, *Config) error)

RegistUpgrader register upgrader

func Upgrade

func Upgrade(db storage.DI, conf *Config) (err error)

Upgrade uprade the db datas to newest verison we use date instead of version later since 2018.09.04, because the version wasn't manage by the developer ps: when use date instead of version, the date should add x prefix cause x > v

func Upsert

func Upsert(db storage.DI, tablename string, row interface{}, idfieldname string, keys []string, ignores []string) (instID int64, preData map[string]interface{}, err error)

Upsert inset row but updata it whitout ignores key if exists same value with keys


type Config

type Config struct {
	OwnerID    string
	SupplierID int
	User       string

Config config for upgrader

type System

type System struct {
	Type string `bson:"type"`

type Upgrader

type Upgrader struct {
	// contains filtered or unexported fields

Upgrader define a version upgrader

type Version

type Version struct {
	System            `bson:",inline"`
	CurrentVersion    string `bson:"current_version"`
	Distro            string `bson:"distro"`
	DistroVersion     string `bson:"distro_version"`
	InitVersion       string `bson:"init_version"`
	InitDistroVersion string `bson:"init_distro_version"`

Jump to

Keyboard shortcuts

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