MCPcopy Create free account
hub / github.com/Tencent/MMKV / encodeInt64

Function encodeInt64

OpenHarmony/MMKV/src/main/cpp/native_bridge.cpp:823–842  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

821}
822
823static napi_value encodeInt64(napi_env env, napi_callback_info info) {
824 size_t argc = 4;
825 napi_value args[4] = {nullptr};
826 NAPI_CALL(napi_get_cb_info(env, info, &argc, args, nullptr, nullptr));
827
828 auto handle = NValueToUInt64(env, args[0]);
829 auto key = NValueToString(env, args[1]);
830 MMKV *kv = reinterpret_cast<MMKV *>(handle);
831 if (kv && key.length() > 0) {
832 auto value = NValueToInt64(env, args[2]);
833 if (IsNValueUndefined(env, args[3])) {
834 auto ret = kv->set(value, key);
835 return BoolToNValue(env, ret);
836 }
837 uint32_t expiration = NValueToUInt32(env, args[3]);
838 auto ret = kv->set(value, key, expiration);
839 return BoolToNValue(env, ret);
840 }
841 return BoolToNValue(env, false);
842}
843
844static napi_value decodeInt64(napi_env env, napi_callback_info info) {
845 size_t argc = 3;

Callers

nothing calls this directly

Calls 7

NValueToUInt64Function · 0.85
NValueToInt64Function · 0.85
NValueToUInt32Function · 0.85
NValueToStringFunction · 0.70
IsNValueUndefinedFunction · 0.70
BoolToNValueFunction · 0.70
setMethod · 0.45

Tested by

no test coverage detected