// This file is generated by generate-std.joke script. Do not edit manually!

package bolt

import (
	. "github.com/candid82/joker/core"
)

var __by_prefix__P ProcFn = __by_prefix_
var by_prefix_ Proc = Proc{Fn: __by_prefix__P, Name: "by_prefix_", Package: "std/bolt"}

func __by_prefix_(_args []Object) Object {
	_c := len(_args)
	switch {
	case _c == 3:
		db := ExtractBoltDB(_args, 0)
		bucket := ExtractString(_args, 1)
		prefix := ExtractString(_args, 2)
		_res := byPrefix(db, bucket, prefix)
		return _res

	default:
		PanicArity(_c)
	}
	return NIL
}

var __close__P ProcFn = __close_
var close_ Proc = Proc{Fn: __close__P, Name: "close_", Package: "std/bolt"}

func __close_(_args []Object) Object {
	_c := len(_args)
	switch {
	case _c == 1:
		db := ExtractBoltDB(_args, 0)
		_res := close(db)
		return _res

	default:
		PanicArity(_c)
	}
	return NIL
}

var __create_bucket__P ProcFn = __create_bucket_
var create_bucket_ Proc = Proc{Fn: __create_bucket__P, Name: "create_bucket_", Package: "std/bolt"}

func __create_bucket_(_args []Object) Object {
	_c := len(_args)
	switch {
	case _c == 2:
		db := ExtractBoltDB(_args, 0)
		name := ExtractString(_args, 1)
		_res := createBucket(db, name)
		return _res

	default:
		PanicArity(_c)
	}
	return NIL
}

var __create_bucket_if_not_exists__P ProcFn = __create_bucket_if_not_exists_
var create_bucket_if_not_exists_ Proc = Proc{Fn: __create_bucket_if_not_exists__P, Name: "create_bucket_if_not_exists_", Package: "std/bolt"}

func __create_bucket_if_not_exists_(_args []Object) Object {
	_c := len(_args)
	switch {
	case _c == 2:
		db := ExtractBoltDB(_args, 0)
		name := ExtractString(_args, 1)
		_res := createBucketIfNotExists(db, name)
		return _res

	default:
		PanicArity(_c)
	}
	return NIL
}

var __delete__P ProcFn = __delete_
var delete_ Proc = Proc{Fn: __delete__P, Name: "delete_", Package: "std/bolt"}

func __delete_(_args []Object) Object {
	_c := len(_args)
	switch {
	case _c == 3:
		db := ExtractBoltDB(_args, 0)
		bucket := ExtractString(_args, 1)
		key := ExtractString(_args, 2)
		_res := delete(db, bucket, key)
		return _res

	default:
		PanicArity(_c)
	}
	return NIL
}

var __delete_bucket__P ProcFn = __delete_bucket_
var delete_bucket_ Proc = Proc{Fn: __delete_bucket__P, Name: "delete_bucket_", Package: "std/bolt"}

func __delete_bucket_(_args []Object) Object {
	_c := len(_args)
	switch {
	case _c == 2:
		db := ExtractBoltDB(_args, 0)
		name := ExtractString(_args, 1)
		_res := deleteBucket(db, name)
		return _res

	default:
		PanicArity(_c)
	}
	return NIL
}

var __get__P ProcFn = __get_
var get_ Proc = Proc{Fn: __get__P, Name: "get_", Package: "std/bolt"}

func __get_(_args []Object) Object {
	_c := len(_args)
	switch {
	case _c == 3:
		db := ExtractBoltDB(_args, 0)
		bucket := ExtractString(_args, 1)
		key := ExtractString(_args, 2)
		_res := get(db, bucket, key)
		return _res

	default:
		PanicArity(_c)
	}
	return NIL
}

var __next_sequence__P ProcFn = __next_sequence_
var next_sequence_ Proc = Proc{Fn: __next_sequence__P, Name: "next_sequence_", Package: "std/bolt"}

func __next_sequence_(_args []Object) Object {
	_c := len(_args)
	switch {
	case _c == 2:
		db := ExtractBoltDB(_args, 0)
		bucket := ExtractString(_args, 1)
		_res := nextSequence(db, bucket)
		return _res

	default:
		PanicArity(_c)
	}
	return NIL
}

var __open__P ProcFn = __open_
var open_ Proc = Proc{Fn: __open__P, Name: "open_", Package: "std/bolt"}

func __open_(_args []Object) Object {
	_c := len(_args)
	switch {
	case _c == 2:
		filename := ExtractString(_args, 0)
		mode := ExtractInt(_args, 1)
		_res := open(filename, mode)
		return MakeBoltDB(_res)

	default:
		PanicArity(_c)
	}
	return NIL
}

var __put__P ProcFn = __put_
var put_ Proc = Proc{Fn: __put__P, Name: "put_", Package: "std/bolt"}

func __put_(_args []Object) Object {
	_c := len(_args)
	switch {
	case _c == 4:
		db := ExtractBoltDB(_args, 0)
		bucket := ExtractString(_args, 1)
		key := ExtractString(_args, 2)
		value := ExtractString(_args, 3)
		_res := put(db, bucket, key, value)
		return _res

	default:
		PanicArity(_c)
	}
	return NIL
}

func Init() {

	InternsOrThunks()
}

var boltNamespace = GLOBAL_ENV.EnsureSymbolIsLib(MakeSymbol("joker.bolt"))

func init() {
	boltNamespace.Lazy = Init
}
