1// Licensed to the Apache Software Foundation (ASF) under one
2// or more contributor license agreements.  See the NOTICE file
3// distributed with this work for additional information
4// regarding copyright ownership.  The ASF licenses this file
5// to you under the Apache License, Version 2.0 (the
6// "License"); you may not use this file except in compliance
7// with the License.  You may obtain a copy of the License at
8//
9// http://www.apache.org/licenses/LICENSE-2.0
10//
11// Unless required by applicable law or agreed to in writing, software
12// distributed under the License is distributed on an "AS IS" BASIS,
13// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14// See the License for the specific language governing permissions and
15// limitations under the License.
16
17// Code generated by the FlatBuffers compiler. DO NOT EDIT.
18
19package flatbuf
20
21import (
22	flatbuffers "github.com/google/flatbuffers/go"
23)
24
25/// Date is either a 32-bit or 64-bit signed integer type representing an
26/// elapsed time since UNIX epoch (1970-01-01), stored in either of two units:
27///
28/// * Milliseconds (64 bits) indicating UNIX time elapsed since the epoch (no
29///   leap seconds), where the values are evenly divisible by 86400000
30/// * Days (32 bits) since the UNIX epoch
31type Date struct {
32	_tab flatbuffers.Table
33}
34
35func GetRootAsDate(buf []byte, offset flatbuffers.UOffsetT) *Date {
36	n := flatbuffers.GetUOffsetT(buf[offset:])
37	x := &Date{}
38	x.Init(buf, n+offset)
39	return x
40}
41
42func (rcv *Date) Init(buf []byte, i flatbuffers.UOffsetT) {
43	rcv._tab.Bytes = buf
44	rcv._tab.Pos = i
45}
46
47func (rcv *Date) Table() flatbuffers.Table {
48	return rcv._tab
49}
50
51func (rcv *Date) Unit() DateUnit {
52	o := flatbuffers.UOffsetT(rcv._tab.Offset(4))
53	if o != 0 {
54		return DateUnit(rcv._tab.GetInt16(o + rcv._tab.Pos))
55	}
56	return 1
57}
58
59func (rcv *Date) MutateUnit(n DateUnit) bool {
60	return rcv._tab.MutateInt16Slot(4, int16(n))
61}
62
63func DateStart(builder *flatbuffers.Builder) {
64	builder.StartObject(1)
65}
66func DateAddUnit(builder *flatbuffers.Builder, unit DateUnit) {
67	builder.PrependInt16Slot(0, int16(unit), 1)
68}
69func DateEnd(builder *flatbuffers.Builder) flatbuffers.UOffsetT {
70	return builder.EndObject()
71}
72