Пример #1
0
		s.Values = s.Values[:c]

		return c
	}

	panic("unexpected capacity of messageStore")
}
func (a *messageStore) Clear() {
	if a.Values != nil {
		a.Values = a.Values[:0]
	}
}

var (
	deleteMessageByIdSQL = gomodel.NewSqlId(func(gomodel.Executor) string {
		return "delete from timing_message where id = ?"
	})

	deleteTimeoutMessagesSQL = gomodel.NewSqlId(func(gomodel.Executor) string {
		return "delete from timing_message where timing < ?"
	})

	insertMessageSQL = gomodel.NewSqlId(func(gomodel.Executor) string {
		return "insert into timing_message(id, value, timing) values (?, ?, ?)"
	})

	queryMessageSQL = gomodel.NewSqlId(func(gomodel.Executor) string {
		return "select value, timing from timing_message where id = ? limit 1"
	})
)
Пример #2
0
func (s *followStore) Ptrs(index int, ptrs []interface{}) {
	s.Values[index].Ptrs(s.Fields, ptrs)
}

func (s *followStore) Realloc(count int) int {
	if c := cap(s.Values); c == count {
		values := make([]Follow, 2*c)
		copy(values, s.Values)
		s.Values = values

		return 2 * c
	} else if c > count {
		s.Values = s.Values[:c]

		return c
	}

	panic("unexpected capacity of followStore")
}
func (a *followStore) Clear() {
	if a.Values != nil {
		a.Values = a.Values[:0]
	}
}

var (
	insertUserFollowSQL = gomodel.NewSqlId(func(gomodel.Tabler) string {
		return "insert into user_follow(user_id, follow_user_id) select ?, ? from DUAL where exists (select id from user where id = ?)"
	})
)
Пример #3
0
}

func (s *followStore) Realloc(count int) int {
	if c := cap(s.Values); c == count {
		values := make([]Follow, 2*c)
		copy(values, s.Values)
		s.Values = values

		return 2 * c
	} else if c > count {
		s.Values = s.Values[:c]

		return c
	}

	panic("unexpected capacity of followStore")
}
func (a *followStore) Clear() {
	if a.Values != nil {
		a.Values = a.Values[:0]
	}
}

var ()

var (
	astConv = gomodel.NewSqlId(func(gomodel.Executor) string {
		return "insert into user_follow(user_id, follow_user_id) select ?, ? from DUAL where exists (select id from user where id = ?)"
	})
)